From 2d74f64a51d80dd6bae48ce2bc37f9e92e8c309f Mon Sep 17 00:00:00 2001 From: Santhosh <52504160+santacodes@users.noreply.github.com> Date: Sun, 8 Sep 2024 20:56:03 +0530 Subject: [PATCH] Fix coverage session inside generated project (#62) Fixes #61 --- template/{{ project_name }}/noxfile.py.jinja | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/template/{{ project_name }}/noxfile.py.jinja b/template/{{ project_name }}/noxfile.py.jinja index 8541438..795257a 100644 --- a/template/{{ project_name }}/noxfile.py.jinja +++ b/template/{{ project_name }}/noxfile.py.jinja @@ -56,9 +56,10 @@ def run_user_tests(session): @nox.session(name="coverage") def run_coverage(session): """Run the coverage tests and generate an XML report.""" - session.posargs.append("--cov=src/{{project_slug}}") - session.posargs.append("--cov-report=xml") - run_user_tests(session) + session.install("setuptools", silent=False) + session.install("coverage", silent=False) + session.install("-e", ".[dev]", silent=False) + session.run("pytest", "--cov=src/{{project_slug}}", "--cov-report=xml", "tests/") @nox.session(name="dev") def set_dev(session):