From 7c18b187deafded4d3c6919fdb8640261d33e631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 30 Nov 2019 04:35:18 +0100 Subject: [PATCH] tests: add include and exclude lists for extra tests loader 'extra' tests run is getting ridiculously long. Allow splitting it into several jobs. Since this appears as just one class from the test loader perspective, implement it as environment variables: - QUBES_TEST_EXTRA_INCLUDE - load just selected tests - QUBES_TEST_EXTRA_EXCLUDE - skip selected tests (to select "the rest" tests) --- qubes/tests/extra.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/qubes/tests/extra.py b/qubes/tests/extra.py index fe61e0bd..a1e0f03e 100644 --- a/qubes/tests/extra.py +++ b/qubes/tests/extra.py @@ -19,6 +19,7 @@ # import asyncio +import os import subprocess import sys @@ -195,7 +196,18 @@ class ExtraTestCase(qubes.tests.SystemTestCase): def load_tests(loader, tests, pattern): + include_list = None + if 'QUBES_TEST_EXTRA_INCLUDE' in os.environ: + include_list = os.environ['QUBES_TEST_EXTRA_INCLUDE'].split() + exclude_list = [] + if 'QUBES_TEST_EXTRA_EXCLUDE' in os.environ: + exclude_list = os.environ['QUBES_TEST_EXTRA_EXCLUDE'].split() + for entry in pkg_resources.iter_entry_points('qubes.tests.extra'): + if include_list is not None and entry.name not in include_list: + continue + if entry.name in exclude_list: + continue try: for test_case in entry.load()(): tests.addTests(loader.loadTestsFromNames([ @@ -210,6 +222,10 @@ def load_tests(loader, tests, pattern): for entry in pkg_resources.iter_entry_points( 'qubes.tests.extra.for_template'): + if include_list is not None and entry.name not in include_list: + continue + if entry.name in exclude_list: + continue try: for test_case in entry.load()(): tests.addTests(loader.loadTestsFromNames(