Skip to content

Event fixes#3331

Merged
quaquel merged 17 commits intomesa:mainfrom
quaquel:event_fixes
Feb 18, 2026
Merged

Event fixes#3331
quaquel merged 17 commits intomesa:mainfrom
quaquel:event_fixes

Conversation

@quaquel
Copy link
Copy Markdown
Member

@quaquel quaquel commented Feb 17, 2026

This PR fixes several minor issues and bugs in mesa.time and mesa.model related to event scheduling and run control.

  1. It moves the relevant tests from mesa.experimental.test_devs into a new folder (time) and test_events. This ensures the test structure mimics the layout of the repo.
  2. It improves code coverage for Schedule. Specifically, it adds additional tests for the post-init validation.
  3. It adds a check that interval in the EventGenerator raises an exception if it is negative (in case of callable) and adds a test for this.
  4. It removes the return from EventGenerator.stop. The idea of stop is that it stops and deposes the generator. There is no need for a return.
  5. The eventlist __len__ and __contains__ now ignore canceled events. This is also explicitly tested.

@quaquel quaquel added bug Release notes label testing Release notes label enhancement Release notes label backport labels Feb 17, 2026
@quaquel quaquel added backport-candidate PRs we might want to backport to an earlier branch and removed backport labels Feb 17, 2026
@github-actions
Copy link
Copy Markdown

Performance benchmarks:

Model Size Init time [95% CI] Run time [95% CI]
BoltzmannWealth small 🔵 -1.8% [-2.3%, -1.3%] 🔵 +0.9% [+0.7%, +1.0%]
BoltzmannWealth large 🔵 -0.6% [-1.3%, -0.0%] 🔵 -0.6% [-2.2%, +1.2%]
Schelling small 🔵 +0.6% [+0.3%, +0.9%] 🔵 +1.2% [+1.0%, +1.3%]
Schelling large 🔵 -0.3% [-1.0%, +0.3%] 🔵 +0.8% [-0.1%, +1.8%]
WolfSheep small 🔵 +0.4% [-0.0%, +0.9%] 🔵 +1.2% [+1.1%, +1.3%]
WolfSheep large 🔵 +0.9% [-0.2%, +2.1%] 🔵 -1.7% [-2.6%, -0.9%]
BoidFlockers small 🔵 +0.6% [+0.1%, +1.2%] 🔵 +1.6% [+1.5%, +1.8%]
BoidFlockers large 🔵 +2.0% [+1.3%, +2.7%] 🔵 +1.6% [+1.4%, +1.7%]

Copy link
Copy Markdown
Member

@EwoutH EwoutH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Indeed backport-worthy.

@quaquel quaquel merged commit 59fd45a into mesa:main Feb 18, 2026
14 checks passed
@quaquel quaquel deleted the event_fixes branch February 18, 2026 09:31
Krishsharma179 pushed a commit to Krishsharma179/mesa that referenced this pull request Feb 21, 2026
EwoutH pushed a commit that referenced this pull request Mar 15, 2026
This commit fixes several minor issues and bugs in `mesa.time` and `mesa.model` related to event scheduling and run control.

1. It moves the relevant tests from `mesa.experimental.test_devs` into a new folder (time) and test_events. This ensures the test structure mimics the layout of the repo.
2. It improves code coverage for Schedule. Specifically, it adds additional tests for the post-init validation.
3. It adds a check that `interval` in the EventGenerator raises an exception if it is negative (in case of callable) and adds a test for this.
4. It removes the return from EventGenerator.stop. The idea of stop is that it stops and deposes the generator. There is no need for a return.
5. The eventlist `__len__` and `__contains__` now ignore canceled events. This is also explicitly tested.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport backport-candidate PRs we might want to backport to an earlier branch bug Release notes label enhancement Release notes label testing Release notes label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants