From 050fef4fc62d22b594ed80cf0e1ab9108086e261 Mon Sep 17 00:00:00 2001 From: BarnabasG Date: Tue, 3 Feb 2026 00:49:17 +0000 Subject: [PATCH] 1.3.1 Fix show uncovered bug --- README.md | 2 +- pyproject.toml | 2 +- src/pytest_api_cov/config.py | 5 +++++ src/pytest_api_cov/pytest_flags.py | 10 ++++++++-- uv.lock | 2 +- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7f11f69..0e9fb2a 100644 --- a/README.md +++ b/README.md @@ -359,7 +359,7 @@ pytest --api-cov-report --api-cov-show-covered-endpoints pytest --api-cov-report --api-cov-show-excluded-endpoints # Hide uncovered endpoints -pytest --api-cov-report --api-cov-show-uncovered-endpoints=false +pytest --api-cov-report --api-cov-hide-uncovered-endpoints # Save JSON report pytest --api-cov-report --api-cov-report-path=api_coverage.json diff --git a/pyproject.toml b/pyproject.toml index c4025b2..4b0e5d6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "pytest-api-cov" -version = "1.3.0" +version = "1.3.1" description = "Pytest Plugin to provide API Coverage statistics for Python Web Frameworks" readme = "README.md" authors = [{ name = "Barnaby Gill", email = "barnabasgill@gmail.com" }] diff --git a/src/pytest_api_cov/config.py b/src/pytest_api_cov/config.py index 52125de..a4c00fa 100644 --- a/src/pytest_api_cov/config.py +++ b/src/pytest_api_cov/config.py @@ -58,6 +58,11 @@ def read_session_config(session_config: Any) -> Dict[str, Any]: value = session_config.getoption(f"--{opt}") if value is not None and value != [] and value is not False: config[key] = value + + # Validating negation flags + if session_config.getoption("--api-cov-hide-uncovered-endpoints"): + config["show_uncovered_endpoints"] = False + return config diff --git a/src/pytest_api_cov/pytest_flags.py b/src/pytest_api_cov/pytest_flags.py index 15b402c..4d04206 100644 --- a/src/pytest_api_cov/pytest_flags.py +++ b/src/pytest_api_cov/pytest_flags.py @@ -21,8 +21,14 @@ def add_pytest_api_cov_flags(parser: pytest.Parser) -> None: parser.addoption( "--api-cov-show-uncovered-endpoints", action="store_true", - default=True, - help="Show uncovered endpoints in the console report.", + default=False, + help="Show uncovered endpoints in the console report (default: True).", + ) + parser.addoption( + "--api-cov-hide-uncovered-endpoints", + action="store_true", + default=False, + help="Hide uncovered endpoints in the console report.", ) parser.addoption( "--api-cov-show-covered-endpoints", diff --git a/uv.lock b/uv.lock index ee30469..d3ecad7 100644 --- a/uv.lock +++ b/uv.lock @@ -687,7 +687,7 @@ wheels = [ [[package]] name = "pytest-api-cov" -version = "1.3.0" +version = "1.3.1" source = { editable = "." } dependencies = [ { name = "fastapi" },