diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 88c00a43b..d2596e138 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -122,6 +122,12 @@ repos: language: system types_or: [rst] + - id: interrogate + name: interrogate + entry: interrogate src/ tests/ ci/ + language: system + types_or: [python] + - id: pyproject-fmt-fix name: pyproject-fmt entry: pyproject-fmt diff --git a/pyproject.toml b/pyproject.toml index eed170f9f..8b6f0d8ec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,6 +58,7 @@ optional-dependencies.dev = [ "enum-tools[sphinx]==0.12.0", "freezegun==1.5.1", "furo==2024.5.6", + "interrogate==1.7.0", "mypy==1.10.0", "pre-commit==3.7.1", "pydocstyle==6.3", @@ -352,6 +353,11 @@ plugins = [ reportUnnecessaryTypeIgnoreComment = true typeCheckingMode = "strict" +[tool.interrogate] +fail-under = 100 +omit-covered-files = true +verbose = 2 + [tool.pydantic-mypy] init_forbid_extra = true init_typed = true diff --git a/src/mock_vws/_flask_server/__init__.py b/src/mock_vws/_flask_server/__init__.py index e69de29bb..81533727f 100644 --- a/src/mock_vws/_flask_server/__init__.py +++ b/src/mock_vws/_flask_server/__init__.py @@ -0,0 +1 @@ +"""Flask server for the mock Vuforia web service.""" diff --git a/src/mock_vws/target.py b/src/mock_vws/target.py index bdc47eac7..634088089 100644 --- a/src/mock_vws/target.py +++ b/src/mock_vws/target.py @@ -128,6 +128,7 @@ def status(self) -> str: @property def _post_processing_target_rating(self) -> int: + """The rating of the target after processing.""" return self.target_tracking_rater(image_content=self.image_value) @property diff --git a/tests/mock_vws/fixtures/credentials.py b/tests/mock_vws/fixtures/credentials.py index 6ae04e43e..dfa5c86c6 100644 --- a/tests/mock_vws/fixtures/credentials.py +++ b/tests/mock_vws/fixtures/credentials.py @@ -27,6 +27,8 @@ class _VuforiaDatabaseSettings(BaseSettings): class _InactiveVuforiaDatabaseSettings(_VuforiaDatabaseSettings): + """Settings for an inactive Vuforia database.""" + model_config = SettingsConfigDict( env_prefix="INACTIVE_VUFORIA_", env_file=Path("vuforia_secrets.env"), diff --git a/tests/mock_vws/fixtures/vuforia_backends.py b/tests/mock_vws/fixtures/vuforia_backends.py index 8cf33efdb..2fbdf51f8 100644 --- a/tests/mock_vws/fixtures/vuforia_backends.py +++ b/tests/mock_vws/fixtures/vuforia_backends.py @@ -70,6 +70,7 @@ def _enable_use_real_vuforia( inactive_database: VuforiaDatabase, monkeypatch: pytest.MonkeyPatch, ) -> Generator[None, None, None]: + """Test against the real Vuforia.""" assert monkeypatch assert inactive_database _delete_all_targets(database_keys=working_database) @@ -81,6 +82,7 @@ def _enable_use_mock_vuforia( inactive_database: VuforiaDatabase, monkeypatch: pytest.MonkeyPatch, ) -> Generator[None, None, None]: + """Test against the in-memory mock Vuforia.""" assert monkeypatch working_database = VuforiaDatabase( database_name=working_database.database_name, @@ -110,6 +112,7 @@ def _enable_use_docker_in_memory( inactive_database: VuforiaDatabase, monkeypatch: pytest.MonkeyPatch, ) -> Generator[None, None, None]: + """Test against mock Vuforia created to be run in a container.""" # We set ``wsgi.input_terminated`` to ``True`` so that when going through # ``requests`` in our tests, the Flask applications # have the given ``Content-Length`` headers and the given data in diff --git a/tests/mock_vws/test_requests_mock_usage.py b/tests/mock_vws/test_requests_mock_usage.py index ad3767ae5..55e08ad01 100644 --- a/tests/mock_vws/test_requests_mock_usage.py +++ b/tests/mock_vws/test_requests_mock_usage.py @@ -32,6 +32,7 @@ def _not_exact_matcher( first_image_content: bytes, second_image_content: bytes, ) -> bool: + """A matcher which returns True if the images are not the same.""" return first_image_content != second_image_content