diff --git a/bench_runner/__main__.py b/bench_runner/__main__.py index 9b191221..5d294874 100644 --- a/bench_runner/__main__.py +++ b/bench_runner/__main__.py @@ -1,5 +1,4 @@ import importlib -import os import sys @@ -26,15 +25,6 @@ } if __name__ == "__main__": - # This lets pytest-cov collect coverage data in a subprocess - if "COV_CORE_SOURCE" in os.environ: - try: - from pytest_cov.embed import init - - init() - except Exception: - sys.stderr.write("pytest-cov: Failed to setup subprocess coverage.") - command = len(sys.argv) >= 2 and sys.argv[1] or "" if command not in COMMANDS: diff --git a/bench_runner/scripts/run_benchmarks.py b/bench_runner/scripts/run_benchmarks.py index 54d6f1dd..c6688431 100644 --- a/bench_runner/scripts/run_benchmarks.py +++ b/bench_runner/scripts/run_benchmarks.py @@ -462,13 +462,4 @@ def dummy(*args, **kwargs): if __name__ == "__main__": - # This lets pytest-cov collect coverage data in a subprocess - if "COV_CORE_SOURCE" in os.environ: - try: - from pytest_cov.embed import init - - init() - except Exception: - sys.stderr.write("pytest-cov: Failed to setup subprocess coverage.") - main() diff --git a/pyproject.toml b/pyproject.toml index 90ccf27c..baccfaaa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ test = [ "filelock==4.2.9", "pyright==1.1.414", "pytest==9.2.0", - "pytest-cov==6.2.1", + "pytest-cov==7.1.0", "pytest-xdist==3.8.0", ] @@ -56,6 +56,9 @@ markers = [ "long_running: marks tests as long_running (deselect with '-m \"not running\"')", ] +[tool.coverage.run] +patch = ["subprocess"] + [tool.coverage.paths] source = [ "bench_runner",