Skip to content

Commit f7cd74d

Browse files
committed
fix(tests): stabilize CLI smoke subprocess runs under pytest-cov and document CI rationale
1 parent 985e5c2 commit f7cd74d

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

.github/workflows/tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ jobs:
3838
run: uv sync --all-extras --dev
3939

4040
- name: Run tests
41+
# Smoke CLI tests intentionally disable subprocess coverage collection
42+
# to avoid runner-specific flakiness while keeping parent-process coverage strict.
4143
run: uv run pytest --cov=codeclone --cov-report=term-missing --cov-fail-under=98
4244

4345
- name: Verify baseline exists

tests/test_cli_smoke.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,29 @@ def run_cli(
1111
env = os.environ.copy()
1212
root_dir = Path(__file__).parents[1]
1313
env["PYTHONPATH"] = str(root_dir) + os.pathsep + env.get("PYTHONPATH", "")
14+
# Keep smoke tests stable under pytest-cov:
15+
# subprocess coverage collection is not required here and can create
16+
# nondeterministic overhead when child process pools are used.
17+
env.pop("COV_CORE_SOURCE", None)
18+
env.pop("COV_CORE_CONFIG", None)
19+
env.pop("COV_CORE_DATAFILE", None)
20+
env.pop("COVERAGE_PROCESS_START", None)
1421

1522
# Try to find venv python
1623
venv_python = root_dir / ".venv" / "bin" / "python"
1724
executable = str(venv_python) if venv_python.exists() else sys.executable
1825

1926
return subprocess.run(
20-
[executable, "-m", "codeclone.cli", *args],
27+
[
28+
executable,
29+
"-m",
30+
"codeclone.cli",
31+
*args,
32+
"--processes",
33+
"1",
34+
"--no-progress",
35+
"--no-color",
36+
],
2137
capture_output=True,
2238
text=True,
2339
cwd=cwd,

0 commit comments

Comments
 (0)