Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions taskcluster/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
20 changes: 20 additions & 0 deletions taskcluster/kinds/test/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions test/test_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
not os.environ.get("TASKGRAPH_USE_THREADS"),
reason="requires multithreading to be enabled",
)
asynconly = pytest.mark.skipif(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
asynconly = pytest.mark.skipif(
multiprocessonly = pytest.mark.skipif(

(async and multiprocess are not the same thing.)

os.environ.get("TASKGRAPH_SERIAL"), reason="requires TASKGRAPH_SERIAL to be 0"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
os.environ.get("TASKGRAPH_SERIAL"), reason="requires TASKGRAPH_SERIAL to be 0"
os.environ.get("TASKGRAPH_SERIAL"), reason="requires multiprocessing to be enabled"

(This is checking whether or not TASKGRAPH_SERIAL is not at all, not looking for whether or not it is 0.)

)


class FakePPE(ProcessPoolExecutor):
Expand All @@ -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)
Expand All @@ -57,6 +61,7 @@ def test_kind_ordering_multiprocess(mocker, maketgg):


@threadsonly
@asynconly
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to fix the threadsonly marker to account for TASKGRAPH_SERIAL rather than stack these in this case, but this works too.

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)
Expand Down
Loading