Unittests: allow running unittests for specific worlds when using unittest runner (#6338)

This commit is contained in:
Silvris
2026-07-18 14:53:35 -05:00
committed by GitHub
parent 6875f9da90
commit 2cde25ffd0
+2 -2
View File
@@ -80,10 +80,10 @@ class WorldSource:
def name(self) -> str:
return Path(self.path).stem
# AP_TEST_WORLDS (pytest only) scopes auto-loading to the named worlds; these are always loaded for the
# AP_TEST_WORLDS scopes auto-loading to the named worlds; these are always loaded for the
# suite's fixtures but aren't themselves worlds under test.
_SUITE_FIXTURE_WORLDS = {"generic", "apquest"}
_test_worlds_env = os.environ.get("AP_TEST_WORLDS") if "pytest" in sys.modules else None
_test_worlds_env = os.environ.get("AP_TEST_WORLDS") if "pytest" in sys.modules or "unittest" in sys.modules else None
_requested_worlds = {name.strip() for name in _test_worlds_env.split(",") if name.strip()} if _test_worlds_env else None
test_worlds_filter = _requested_worlds | _SUITE_FIXTURE_WORLDS if _requested_worlds else None