Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: give seed on default tests and fix execnet error #3520

Merged
merged 11 commits into from
Jun 22, 2024
6 changes: 3 additions & 3 deletions test/bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,12 @@ def test_all_state_can_reach_everything(self):
"""Ensure all state can reach everything and complete the game with the defined options"""
if not (self.run_default_tests and self.constructed):
return
with self.subTest("Game", game=self.game):
with self.subTest("Game", game=self.game, seed=self.multiworld.seed):
excluded = self.multiworld.worlds[self.player].options.exclude_locations.value
state = self.multiworld.get_all_state(False)
for location in self.multiworld.get_locations():
if location.name not in excluded:
with self.subTest("Location should be reached", location=location):
with self.subTest("Location should be reached", location=location.name):
Copy link
Collaborator

Choose a reason for hiding this comment

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

does this keep failing the serialization dumping? i thought we had a proper repr for location, but if we don't i think that's probably the better fix for this

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the cause of the serialization function failing within tests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Looking at it, Location does have a _repr_ that calls _str_. We could use str(location) instead, but the end result is the same.

reachable = location.can_reach(state)
self.assertTrue(reachable, f"{location.name} unreachable")
with self.subTest("Beatable"):
Expand All @@ -308,7 +308,7 @@ def test_empty_state_can_reach_something(self):
"""Ensure empty state can reach at least one location with the defined options"""
if not (self.run_default_tests and self.constructed):
return
with self.subTest("Game", game=self.game):
with self.subTest("Game", game=self.game, seed=self.multiworld.seed):
state = CollectionState(self.multiworld)
locations = self.multiworld.get_reachable_locations(state, self.player)
self.assertGreater(len(locations), 0,
Expand Down
Loading