mirror of
https://github.com/ArchipelagoMW/Archipelago.git
synced 2026-07-27 12:10:45 -07:00
Core: Allow running unit tests scoped to specific worlds (#6290)
This allows the unit tests to be run on specific worlds only, it works by using an environment variable AP_TEST_WORLDS which is a comma separated list of world directories.
This commit is contained in:
@@ -4,9 +4,11 @@ from worlds.AutoWorld import AutoWorldRegister
|
||||
|
||||
|
||||
class TestWebDescriptions(unittest.TestCase):
|
||||
world_relevant = True
|
||||
|
||||
def test_item_descriptions_have_valid_names(self) -> None:
|
||||
"""Ensure all item descriptions match an item name or item group name"""
|
||||
for game_name, world_type in AutoWorldRegister.world_types.items():
|
||||
for game_name, world_type in AutoWorldRegister.testable_worlds.items():
|
||||
valid_names = world_type.item_names.union(world_type.item_name_groups)
|
||||
for name in world_type.web.item_descriptions:
|
||||
with self.subTest("Name should be valid", game=game_name, item=name):
|
||||
@@ -15,7 +17,7 @@ class TestWebDescriptions(unittest.TestCase):
|
||||
|
||||
def test_location_descriptions_have_valid_names(self) -> None:
|
||||
"""Ensure all location descriptions match a location name or location group name"""
|
||||
for game_name, world_type in AutoWorldRegister.world_types.items():
|
||||
for game_name, world_type in AutoWorldRegister.testable_worlds.items():
|
||||
valid_names = world_type.location_names.union(world_type.location_name_groups)
|
||||
for name in world_type.web.location_descriptions:
|
||||
with self.subTest("Name should be valid", game=game_name, location=name):
|
||||
|
||||
@@ -9,12 +9,14 @@ from worlds.AutoWorld import AutoWorldRegister
|
||||
|
||||
|
||||
class TestDocs(unittest.TestCase):
|
||||
world_relevant = True
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None:
|
||||
WebHost.copy_tutorials_files_to_static()
|
||||
|
||||
def test_has_tutorial(self):
|
||||
for game_name, world_type in AutoWorldRegister.world_types.items():
|
||||
for game_name, world_type in AutoWorldRegister.testable_worlds.items():
|
||||
if not world_type.hidden:
|
||||
with self.subTest(game_name):
|
||||
tutorials = world_type.web.tutorials
|
||||
@@ -29,7 +31,7 @@ class TestDocs(unittest.TestCase):
|
||||
)
|
||||
|
||||
def test_has_game_info(self):
|
||||
for game_name, world_type in AutoWorldRegister.world_types.items():
|
||||
for game_name, world_type in AutoWorldRegister.testable_worlds.items():
|
||||
if not world_type.hidden:
|
||||
safe_name = secure_filename(game_name)
|
||||
target_path = Utils.local_path("WebHostLib", "static", "generated", "docs", safe_name)
|
||||
|
||||
@@ -7,6 +7,8 @@ import WebHost
|
||||
|
||||
|
||||
class TestFileGeneration(unittest.TestCase):
|
||||
world_relevant = True
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None:
|
||||
cls.correct_path = os.path.join(os.path.dirname(WebHost.__file__), "WebHostLib")
|
||||
|
||||
@@ -6,9 +6,11 @@ from Options import OptionCounter, NamedRange, NumericOption, OptionList, Option
|
||||
|
||||
|
||||
class TestOptionPresets(unittest.TestCase):
|
||||
world_relevant = True
|
||||
|
||||
def test_option_presets_have_valid_options(self):
|
||||
"""Test that all predefined option presets are valid options."""
|
||||
for game_name, world_type in AutoWorldRegister.world_types.items():
|
||||
for game_name, world_type in AutoWorldRegister.testable_worlds.items():
|
||||
presets = world_type.web.options_presets
|
||||
for preset_name, preset in presets.items():
|
||||
for option_name, option_value in preset.items():
|
||||
@@ -38,7 +40,7 @@ class TestOptionPresets(unittest.TestCase):
|
||||
"""Test that option preset values are not a special flavor of 'random' or use from_text to resolve another
|
||||
value.
|
||||
"""
|
||||
for game_name, world_type in AutoWorldRegister.world_types.items():
|
||||
for game_name, world_type in AutoWorldRegister.testable_worlds.items():
|
||||
presets = world_type.web.options_presets
|
||||
for preset_name, preset in presets.items():
|
||||
for option_name, option_value in preset.items():
|
||||
|
||||
Reference in New Issue
Block a user