Skip to content

Use interrogate to enforce docstring coverage #2100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/mock_vws/_flask_server/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Flask server for the mock Vuforia web service."""
1 change: 1 addition & 0 deletions src/mock_vws/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/mock_vws/fixtures/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
3 changes: 3 additions & 0 deletions tests/mock_vws/fixtures/vuforia_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/mock_vws/test_requests_mock_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down