diff --git a/justfile b/justfile index 8769698..6b79aa6 100644 --- a/justfile +++ b/justfile @@ -65,13 +65,12 @@ BUILDDIR := "docs/_build" # Run coverage @cov: - {{uv}} coverage run -m pytest - {{uv}} coverage report -m + {{uv}} -m pytest --cov # Run coverage @cov-html: - {{uv}} coverage run -m pytest - {{uv}} coverage html + {{uv}} -m pytest --cov --cov-report=html --cov-context=test + echo Coverage report: file://`pwd`/htmlcov/index.html # Sync the package @sync: diff --git a/pyproject.toml b/pyproject.toml index 7c87cce..016dd79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,6 +51,7 @@ test = [ "django-debug-toolbar>=4.4.0", "nox>=2024.4.15", "djpress-example-plugin", + "pytest-cov>=6.0.0", ] docs = [ "cogapp>=3.4.1", @@ -91,6 +92,9 @@ pythonpath = ". example" DJANGO_SETTINGS_MODULE = "config.settings_testing" python_files = "tests.py test_*.py *_tests.py" +[tool.coverage.html] +show_contexts = true + [tool.coverage.run] branch = true include = ["src/djpress/*"] diff --git a/uv.lock b/uv.lock index 03fe15d..928321a 100644 --- a/uv.lock +++ b/uv.lock @@ -324,6 +324,7 @@ test = [ { name = "djpress-example-plugin" }, { name = "nox" }, { name = "pytest" }, + { name = "pytest-cov" }, { name = "pytest-coverage" }, { name = "pytest-django" }, ] @@ -344,6 +345,7 @@ requires-dist = [ { name = "myst-parser", marker = "extra == 'docs'", specifier = ">=4.0.0" }, { name = "nox", marker = "extra == 'test'", specifier = ">=2024.4.15" }, { name = "pytest", marker = "extra == 'test'", specifier = ">=8.3.3" }, + { name = "pytest-cov", marker = "extra == 'test'", specifier = ">=6.0.0" }, { name = "pytest-coverage", marker = "extra == 'test'", specifier = ">=0.0" }, { name = "pytest-django", marker = "extra == 'test'", specifier = ">=4.9.0" }, { name = "sphinx", marker = "extra == 'docs'", specifier = ">=8.1.3" },