Skip to content

Make batch_run pytestable by adding main() functions#143

Merged
EwoutH merged 3 commits intomainfrom
batch_run_main
Jul 22, 2024
Merged

Make batch_run pytestable by adding main() functions#143
EwoutH merged 3 commits intomainfrom
batch_run_main

Conversation

@EwoutH
Copy link
Copy Markdown
Member

@EwoutH EwoutH commented Jul 22, 2024

Added a main() function to bank_reserves batch_run.py and sugarscape_g1mt run.py scripts to facilitate testing and script execution.

The main() function encapsulates the primary script logic, allowing for easier modular testing and execution. By defining script operations within main(), we can directly invoke this function in testing environments without relying on command-line execution. This practice enhances code readability, maintainability, and testability, providing a clear entry point for the script's functionality.

Part of mesa/mesa#2184 and required for mesa/mesa#2185.

EwoutH added 2 commits July 22, 2024 09:35
Added a main() function to `batch_run.py` script to facilitate testing and script execution.

The `main()` function encapsulates the primary script logic, allowing for easier modular testing and execution. By defining script operations within `main()`, we can directly invoke this function in testing environments without relying on command-line execution. This practice enhances code readability, maintainability, and testability, providing a clear entry point for the script's functionality.
Added a main() function to `run.py` script to facilitate testing and script execution.

The `main()` function encapsulates the primary script logic, allowing for easier modular testing and execution. By defining script operations within `main()`, we can directly invoke this function in testing environments without relying on command-line execution. This practice enhances code readability, maintainability, and testability, providing a clear entry point for the script's functionality.
@EwoutH EwoutH requested review from rht and tpike3 July 22, 2024 07:40
@EwoutH EwoutH merged commit e137a60 into main Jul 22, 2024
@rht rht deleted the batch_run_main branch July 22, 2024 09:42
Harshini2411 pushed a commit to Harshini2411/mesa-examples that referenced this pull request Mar 16, 2026
Added a main() function to bank_reserves `batch_run.py` and sugarscape_g1mt `run.py` scripts to facilitate testing and script execution.

The `main()` function encapsulates the primary script logic, allowing for easier modular testing and execution. By defining script operations within `main()`, we can directly invoke this function in testing environments without relying on command-line execution. This practice enhances code readability, maintainability, and testability, providing a clear entry point for the script's functionality.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant