Skip to content

Commit 06698c4

Browse files
committed
test: fix test_main under Python 3.14
Python 3.14 switched multiprocessing to use the "forkserver" start method. This means the forked subprocess don't inherit the parent process' memory and the monkeypatched functions (via the `run_taskgraph` fixture) were no longer applied. This works around the issue by actually creating bad parameter files to avoid monkeypatching.
1 parent 683b236 commit 06698c4

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

test/test_main.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,23 @@ def test_show_taskgraph_attr(run_taskgraph, capsys, attr, expected):
6565

6666

6767
def test_show_taskgraph_parallel(run_taskgraph):
68+
# Test that parallel execution works correctly with valid parameters
6869
res = run_taskgraph(["full", "-p", "taskcluster/test/params"])
6970
assert res == 0
7071

71-
# Craft params to cause an exception
72-
res = run_taskgraph(
73-
["full", "-p", "taskcluster/test/params"], params={"_kinds": None}
74-
)
75-
assert res == 1
72+
73+
def test_show_taskgraph_parallel_bad_params(tmp_path):
74+
# Create parameter files that will cause processing errors
75+
bad_params_dir = tmp_path / "bad_params"
76+
bad_params_dir.mkdir()
77+
(bad_params_dir / "invalid-yaml.yml").write_text("invalid: yaml: [syntax error")
78+
79+
try:
80+
result = taskgraph_main(["full", "-p", str(bad_params_dir)])
81+
except SystemExit as e:
82+
result = e.code
83+
84+
assert result == 1
7685

7786

7887
def test_show_taskgraph_force_local_files_changed(mocker, run_taskgraph):

0 commit comments

Comments
 (0)