Skip to content

Stardew Valley: Remove some duplicate code in tests #2006

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

Merged
merged 1 commit into from
Jul 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions worlds/stardew_valley/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

from BaseClasses import MultiWorld
from test.TestBase import WorldTestBase
from test.general import gen_steps
from test.general import gen_steps, setup_solo_multiworld as setup_base_solo_multiworld
from .. import StardewValleyWorld, options
from ..mods.mod_data import ModNames
from ...AutoWorld import call_all
from worlds.AutoWorld import call_all


class SVTestBase(WorldTestBase):
Expand Down Expand Up @@ -106,17 +106,14 @@ def setup_solo_multiworld(test_options=None, seed=None,
if frozen_options in _cache:
return _cache[frozen_options]

multiworld = MultiWorld(1)
multiworld.game[1] = StardewValleyWorld.game
multiworld.player_name = {1: "Tester"}
multiworld = setup_base_solo_multiworld(StardewValleyWorld, ())
multiworld.set_seed(seed)
# print(f"Seed: {multiworld.seed}") # Uncomment to print the seed for every test
args = Namespace()
for name, option in StardewValleyWorld.option_definitions.items():
value = option(test_options[name]) if name in test_options else option.from_any(option.default)
setattr(args, name, {1: value})
multiworld.set_options(args)
multiworld.set_default_common_options()
for step in gen_steps:
call_all(multiworld, step)

Expand Down