From 56a26be75d3470945040285a504701ec50cefdd5 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Fri, 8 Jul 2022 10:53:57 +0100 Subject: Fix the coverage tracking nox session This session now correctly handles tracking coverage and running tests. --- noxfile.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'noxfile.py') diff --git a/noxfile.py b/noxfile.py index 9de795fe5..b7d3d8253 100644 --- a/noxfile.py +++ b/noxfile.py @@ -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", }, ) -- cgit v1.2.1