mirror of
https://github.com/ArchipelagoMW/Archipelago.git
synced 2026-04-21 16:33:30 -07:00
Stardew Valley: Cut tests by 3 minutes (#2375)
* Stardew Valley: Test: unify mods * Stardew Valley: Test: don't use SVTestBase where setUp is unused * Stardew Valley: Test: remove duplicate backpack test * Stardew Valley: Test: remove 2,3,4 heart tests assume the math is correct with just 2 points on the curve * Stardew Valley: Test: reduce duplicate test/gen runs * Stardew Valley: Test: Change 'long' tests to not use TestBase TestBase' setUp is not being used in the changed TestCases * Stardew Valley: Test: Use subtests and inheritance for backpacks * Stardew Valley: Test: add flag to skip some of the extensive tests by default
This commit is contained in:
@@ -1,23 +1,17 @@
|
||||
import unittest
|
||||
from typing import List, Union
|
||||
|
||||
from BaseClasses import MultiWorld
|
||||
from worlds.stardew_valley.mods.mod_data import ModNames
|
||||
from worlds.stardew_valley.mods.mod_data import all_mods
|
||||
from worlds.stardew_valley.test import setup_solo_multiworld
|
||||
from worlds.stardew_valley.test.TestOptions import basic_checks, SVTestBase
|
||||
from worlds.stardew_valley.test.TestOptions import basic_checks, SVTestCase
|
||||
from worlds.stardew_valley.items import item_table
|
||||
from worlds.stardew_valley.locations import location_table
|
||||
from worlds.stardew_valley.options import Mods
|
||||
from .option_names import options_to_include
|
||||
|
||||
all_mods = frozenset({ModNames.deepwoods, ModNames.tractor, ModNames.big_backpack,
|
||||
ModNames.luck_skill, ModNames.magic, ModNames.socializing_skill, ModNames.archaeology,
|
||||
ModNames.cooking_skill, ModNames.binning_skill, ModNames.juna,
|
||||
ModNames.jasper, ModNames.alec, ModNames.yoba, ModNames.eugene,
|
||||
ModNames.wellwick, ModNames.ginger, ModNames.shiko, ModNames.delores,
|
||||
ModNames.ayeisha, ModNames.riley, ModNames.skull_cavern_elevator})
|
||||
|
||||
|
||||
def check_stray_mod_items(chosen_mods: Union[List[str], str], tester: SVTestBase, multiworld: MultiWorld):
|
||||
def check_stray_mod_items(chosen_mods: Union[List[str], str], tester: unittest.TestCase, multiworld: MultiWorld):
|
||||
if isinstance(chosen_mods, str):
|
||||
chosen_mods = [chosen_mods]
|
||||
for multiworld_item in multiworld.get_items():
|
||||
@@ -30,7 +24,7 @@ def check_stray_mod_items(chosen_mods: Union[List[str], str], tester: SVTestBase
|
||||
tester.assertTrue(location.mod_name is None or location.mod_name in chosen_mods)
|
||||
|
||||
|
||||
class TestGenerateModsOptions(SVTestBase):
|
||||
class TestGenerateModsOptions(SVTestCase):
|
||||
|
||||
def test_given_mod_pairs_when_generate_then_basic_checks(self):
|
||||
if self.skip_long_tests:
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import unittest
|
||||
from typing import Dict
|
||||
|
||||
from BaseClasses import MultiWorld
|
||||
from Options import SpecialRange
|
||||
from .option_names import options_to_include
|
||||
from worlds.stardew_valley.test.checks.world_checks import assert_can_win, assert_same_number_items_locations
|
||||
from .. import setup_solo_multiworld, SVTestBase
|
||||
from .. import setup_solo_multiworld, SVTestCase
|
||||
|
||||
|
||||
def basic_checks(tester: SVTestBase, multiworld: MultiWorld):
|
||||
def basic_checks(tester: unittest.TestCase, multiworld: MultiWorld):
|
||||
assert_can_win(tester, multiworld)
|
||||
assert_same_number_items_locations(tester, multiworld)
|
||||
|
||||
@@ -20,7 +21,7 @@ def get_option_choices(option) -> Dict[str, int]:
|
||||
return {}
|
||||
|
||||
|
||||
class TestGenerateDynamicOptions(SVTestBase):
|
||||
class TestGenerateDynamicOptions(SVTestCase):
|
||||
def test_given_option_pair_when_generate_then_basic_checks(self):
|
||||
if self.skip_long_tests:
|
||||
return
|
||||
|
||||
@@ -4,7 +4,7 @@ import random
|
||||
from BaseClasses import MultiWorld
|
||||
from Options import SpecialRange, Range
|
||||
from .option_names import options_to_include
|
||||
from .. import setup_solo_multiworld, SVTestBase
|
||||
from .. import setup_solo_multiworld, SVTestCase
|
||||
from ..checks.goal_checks import assert_perfection_world_is_valid, assert_goal_world_is_valid
|
||||
from ..checks.option_checks import assert_can_reach_island_if_should, assert_cropsanity_same_number_items_and_locations, \
|
||||
assert_festivals_give_access_to_deluxe_scarecrow
|
||||
@@ -72,14 +72,14 @@ def generate_many_worlds(number_worlds: int, start_index: int) -> Dict[int, Mult
|
||||
return multiworlds
|
||||
|
||||
|
||||
def check_every_multiworld_is_valid(tester: SVTestBase, multiworlds: Dict[int, MultiWorld]):
|
||||
def check_every_multiworld_is_valid(tester: SVTestCase, multiworlds: Dict[int, MultiWorld]):
|
||||
for multiworld_id in multiworlds:
|
||||
multiworld = multiworlds[multiworld_id]
|
||||
with tester.subTest(f"Checking validity of world {multiworld_id}"):
|
||||
check_multiworld_is_valid(tester, multiworld_id, multiworld)
|
||||
|
||||
|
||||
def check_multiworld_is_valid(tester: SVTestBase, multiworld_id: int, multiworld: MultiWorld):
|
||||
def check_multiworld_is_valid(tester: SVTestCase, multiworld_id: int, multiworld: MultiWorld):
|
||||
assert_victory_exists(tester, multiworld)
|
||||
assert_same_number_items_locations(tester, multiworld)
|
||||
assert_goal_world_is_valid(tester, multiworld)
|
||||
@@ -88,7 +88,7 @@ def check_multiworld_is_valid(tester: SVTestBase, multiworld_id: int, multiworld
|
||||
assert_festivals_give_access_to_deluxe_scarecrow(tester, multiworld)
|
||||
|
||||
|
||||
class TestGenerateManyWorlds(SVTestBase):
|
||||
class TestGenerateManyWorlds(SVTestCase):
|
||||
def test_generate_many_worlds_then_check_results(self):
|
||||
if self.skip_long_tests:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user