@@ -39,17 +39,17 @@ jobs:
3939 run : |
4040 from os import environ
4141
42- # Deduplicate file paths. The same file will show up
43- # multiple times because each file can have many tests.
42+ # Deduplicate file paths.
4443 with open("collected.txt", encoding="utf-8") as lines:
45- paths = sorted({line.strip(). partition("::")[0] for line in lines})
44+ paths = sorted({line.partition("::")[0] for line in lines})
4645
47- max_size = 3
46+ max_size = 3 # Max files per group
4847 test_groups = {"include": []}
4948
50- # Slice the list of paths into subgroups .
49+ # Slice the list of paths into sublists and quote each path .
5150 for i, j in enumerate(range(0, len(paths), max_size), start=1):
52- test_groups["include"].append({"name": f"Group {i}", "files": " ".join(paths[j : j + max_size])})
51+ quoted = [f"'{path}'" for path in paths[j : j + max_size]]
52+ test_groups["include"].append({"name": f"Group {i}", "paths": " ".join(quoted)})
5353
5454 print(f"::notice ::Groups: {test_groups}")
5555 with open(environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as f:
7777 uv tree
7878
7979 - name : Run test
80- run : uv run -- pytest '${{ matrix.files }}'
80+ # Don't quote the matrix argument because it would cause pytest
81+ # to treat the entire list of file paths as a single argument.
82+ run : uv run -- pytest ${{ matrix.paths }}
0 commit comments