diff --git a/taskcluster/config.yml b/taskcluster/config.yml index fd6eeedaa..60d32c40c 100644 --- a/taskcluster/config.yml +++ b/taskcluster/config.yml @@ -8,6 +8,7 @@ treeherder: 'doc': 'Documentation tasks' 'unit': 'Unit test tasks' 'unit-multithread': 'Unit test tasks with multithreading enabled' + 'unit-serial': 'Unit test tasks with serial enabled' 'integration': 'Integration test tasks' index: diff --git a/taskcluster/kinds/test/linux.yml b/taskcluster/kinds/test/linux.yml index c0b3b8280..94f73ba58 100644 --- a/taskcluster/kinds/test/linux.yml +++ b/taskcluster/kinds/test/linux.yml @@ -70,6 +70,26 @@ unit-multithread: command: >- uv run coverage run --data-file /builds/worker/artifacts/coverage --context=py{matrix[python]} -m pytest -vv +unit-serial: + description: "Run unit tests with py{matrix[python]} on Linux in serial mode" + matrix: + set-name: "unit-serial-py{matrix[python]}" + substitution-fields: [description, run.command, treeherder, worker, attributes] + python: ["314"] + worker: + docker-image: {in-tree: python} + env: + TASKGRAPH_SERIAL: "1" + artifacts: + - type: file + path: "/builds/worker/artifacts/coverage" + name: "public/coverage.py{matrix[python]}" + treeherder: + symbol: unit-serial(py{matrix[python]}) + run: + command: >- + uv run coverage run --data-file /builds/worker/artifacts/coverage --context=py{matrix[python]} -m pytest -vv + integration: description: "Run unit tests with py{matrix[python]} on Linux with resolution {matrix[resolution]}" attributes: diff --git a/test/test_generator.py b/test/test_generator.py index 2024f6178..ed2af30b7 100644 --- a/test/test_generator.py +++ b/test/test_generator.py @@ -23,6 +23,9 @@ not os.environ.get("TASKGRAPH_USE_THREADS"), reason="requires multithreading to be enabled", ) +asynconly = pytest.mark.skipif( + os.environ.get("TASKGRAPH_SERIAL"), reason="requires TASKGRAPH_SERIAL to be 0" +) class FakePPE(ProcessPoolExecutor): @@ -42,6 +45,7 @@ def submit(self, kind_load_tasks, *args): @linuxonly +@asynconly def test_kind_ordering_multiprocess(mocker, maketgg): "When task kinds depend on each other, they are loaded in postorder" mocked_ppe = mocker.patch.object(generator, "ProcessPoolExecutor", new=FakePPE) @@ -57,6 +61,7 @@ def test_kind_ordering_multiprocess(mocker, maketgg): @threadsonly +@asynconly def test_kind_ordering_multithread(mocker, maketgg): "When task kinds depend on each other, they are loaded in postorder" mocked_tpe = mocker.patch.object(generator, "ThreadPoolExecutor", new=FakeTPE)