From c061846371a283d118dc11c8895185f11148d7bd Mon Sep 17 00:00:00 2001 From: xqt Date: Mon, 29 Jul 2024 17:02:42 +0200 Subject: [PATCH] [tests] simplify tests collector Change-Id: I422ced7caf868b9239ead8c1bc1d4d56259144e7 --- tests/__init__.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/__init__.py b/tests/__init__.py index cf3b51cf7c..43aed9d970 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -183,11 +183,11 @@ def _unknown_test_modules(): extra_test_modules = _unknown_test_modules() if 'PYWIKIBOT_TEST_MODULES' in os.environ: - _enabled_test_modules = os.environ['PYWIKIBOT_TEST_MODULES'].split(',') - disabled_test_modules = (library_test_modules - | extra_test_modules - | script_test_modules - - set(_enabled_test_modules)) + enabled_test_modules = os.environ['PYWIKIBOT_TEST_MODULES'].split(',') +else: + enabled_test_modules = chain(library_test_modules, + extra_test_modules, + script_test_modules) def unittest_print(*args, **kwargs): @@ -218,9 +218,7 @@ def collector(loader=unittest.loader.defaultTestLoader): f' {disabled_tests!r}') modules = (module - for module in chain(library_test_modules, - extra_test_modules, - script_test_modules) + for module in enabled_test_modules if module not in disabled_test_modules) test_list = []