tests: Resolve warnings by removing scheduler and updating arguments #2329
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR updates several test files to resolve warnings and deprecations introduced in Mesa 3.0. The changes align the tests with the new AgentSet functionality and the removal of schedulers.
Changes
1. Remove scheduler from batch_run tests
The
schedule
parameter and related code were removed from theMockModel
intest_batch_run.py
. This aligns with the deprecation of schedulers in favor of AgentSet functionality.Example:
Related PR: #1926
2. Remove scheduler from datacollector tests
The
schedule
attribute and related methods were removed from theMockModel
intest_datacollector.py
. Thestep
method now usesself.agents.do("step")
instead ofself.schedule.step()
.Example:
Related PR: #1926
3. Replace
n
withat_most
in AgentSet selectIn
test_agent.py
, the deprecatedn
parameter inAgentSet.select()
was replaced withat_most
.Example:
Related PR: #2253
4. Replace scheduler in lifespan tests
In
test_lifespan.py
, theRandomActivation
scheduler was removed, and thestep
method now usesself.agents.shuffle_do("step")
. The order of stepping and data collection was also adjusted to align with the new structure.Example:
Related PR: #1926
5. Rename Agent classes to not start with Test
Agent classes in test files were renamed to avoid starting with "Test" to prevent confusion with test methods.
Example:
This change improves clarity and adheres to common naming conventions for test classes.
Summary
These updates resolve warnings and deprecations introduced in Mesa 3.0, particularly related to the removal of schedulers and the new AgentSet functionality. The changes ensure that our tests are up-to-date with the latest Mesa API and best practices.