Skip to content

Reorganize and deduplicate event-related tests - #3529

Merged
EwoutH merged 1 commit into
mesa:mainfrom
EwoutH:event_tests
Mar 13, 2026
Merged

EwoutH merged 1 commit into
mesa:mainfrom
EwoutH:event_tests

Conversation

@EwoutH

@EwoutH EwoutH commented Mar 13, 2026

Copy link
Copy Markdown
Member

Summary

Restructures test_events.py, test_schedule_run.py, and test_model.py to remove duplications, improve test granularity, and fix a test discovery bug.

Motive

Several issues accumulated across the three event-related test files: Schedule validation was tested in both test_events.py and test_schedule_run.py, past-time scheduling guards lived in test_model.py instead of alongside the other scheduling tests, two large monolithic test functions made failure diagnosis difficult, unittest.TestCase was mixed with pytest style, and a typo (etest_reset_rng) silently prevented a test from running.

Implementation

  • move Schedule validation tests exclusively into test_events.py
  • move past-time scheduling guard tests from test_model.py into test_schedule_run.py
  • split monolithic test_simulation_event and test_eventlist functions into focused test classes
  • convert unittest.TestCase usage to pytest style
  • add edge case tests for run_for(0), schedule_event at t=0, and event/recurring interaction
  • fix the etest_reset_rng typo in test_model.py that prevented the test from being discovered by pytest

@EwoutH
EwoutH requested a review from quaquel March 13, 2026 12:11
@EwoutH EwoutH added the testing Release notes label label Mar 13, 2026
@github-actions

This comment was marked as off-topic.

Reorganize event-related tests to eliminate duplications and improve structure. Move Schedule validation tests exclusively into test_events.py, move past-time scheduling guard tests from test_model.py into test_schedule_run.py, split monolithic test_simulation_event and test_eventlist functions into focused test classes, convert unittest.TestCase usage to pytest style, add edge case tests for run_for(0), schedule_event at t=0, and event/recurring interaction, and fix the etest_reset_rng typo in test_model.py that prevented the test from being discovered by pytest.
@EwoutH
EwoutH merged commit cbf528b into mesa:main Mar 13, 2026
11 checks passed
EwoutH added a commit that referenced this pull request Oct 28, 2026
Reorganize event-related tests to eliminate duplications and improve structure. Move Schedule validation tests exclusively into test_events.py, move past-time scheduling guard tests from test_model.py into test_schedule_run.py, split monolithic test_simulation_event and test_eventlist functions into focused test classes, convert unittest.TestCase usage to pytest style, add edge case tests for run_for(0), schedule_event at t=0, and event/recurring interaction, and fix the etest_reset_rng typo in test_model.py that prevented the test from being discovered by pytest.

(cherry picked from commit cbf528b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Release notes label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant