Skip to content

Commit ba56e9a

Browse files
committed
Normalize pytest-cov contexts and parallelize map build
1 parent dbadd23 commit ba56e9a

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
echo "Test map cache miss; generating map from tests."
6565
pip install --no-build-isolation --no-deps .
6666
mkdir -p .ci
67-
pytest -q --tb=short --disable-warnings -n 0 -p pytest_cov \
67+
pytest -q --tb=short --disable-warnings -n auto -p pytest_cov \
6868
--cov=ultraplot --cov-branch --cov-context=test --cov-report= \
6969
ultraplot/tests
7070
python tools/ci/build_test_map.py --coverage-file .coverage --output .ci/test-map.json --root .

tools/ci/build_test_map.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@ def build_map(coverage_file: str, repo_root: str) -> dict[str, list[str]]:
3434

3535
contexts = set()
3636
for ctxs in contexts_by_line.values():
37-
if ctxs:
38-
contexts.update(ctxs)
37+
if not ctxs:
38+
continue
39+
for ctx in ctxs:
40+
if not ctx:
41+
continue
42+
# Pytest-cov can append "|run"/"|setup"/"|teardown" to nodeids.
43+
# Strip phase suffixes so selection uses valid nodeids.
44+
contexts.add(ctx.split("|", 1)[0])
3945
if contexts:
4046
files_map[rel] = contexts
4147

0 commit comments

Comments
 (0)