From 2cde25ffd0d4cb1404504f64d156a93448cdecb8 Mon Sep 17 00:00:00 2001 From: Silvris <58583688+Silvris@users.noreply.github.com> Date: Sat, 18 Jul 2026 14:53:35 -0500 Subject: [PATCH] Unittests: allow running unittests for specific worlds when using unittest runner (#6338) --- worlds/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worlds/__init__.py b/worlds/__init__.py index da948b9cf3..c024ee1e42 100644 --- a/worlds/__init__.py +++ b/worlds/__init__.py @@ -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