Fix the coverage tracking nox session
This session now correctly handles tracking coverage and running tests.
@@ -229,15 +229,23 @@ def vendoring(session: nox.Session) -> None:
@nox.session
def coverage(session: nox.Session) -> None:
- if not os.path.exists("./.coverage-output"):
- os.mkdir("./.coverage-output")
+ # Install source distribution
+ run_with_protected_pip(session, "install", ".")
+
+ # Install test dependencies
+ run_with_protected_pip(session, "install", "-r", REQUIREMENTS["tests"])
+
+ if not os.path.exists(".coverage-output"):
+ os.mkdir(".coverage-output")
session.run(
"pytest",
"--cov=pip",
"--cov-config=./setup.cfg",
+ *session.posargs,
env={
"COVERAGE_OUTPUT_DIR": "./.coverage-output",
- "COVERAGE_PROCESS_START": "./setup.cfg",
+ "COVERAGE_PROCESS_START": os.fsdecode(Path("setup.cfg").resolve()),
+ "SETUPTOOLS_USE_DISTUTILS": "stdlib",
},
)
