Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#178)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.5.7 → v0.6.1](astral-sh/ruff-pre-commit@v0.5.7...v0.6.1)

* [pre-commit.ci] auto fixes from pre-commit hooks

For more information, see https://pre-commit.ci

* Update ruff config

Include docs/example/** in the per-file-ignore section, adding blind
excepts, print-statements, and ignore required imports (i.e., don't
force include the `from __future__ import annotations`.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Casper Welzel Andersen <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and CasperWA authored Aug 20, 2024
1 parent d110d62 commit 7a6e578
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ repos:
# Ruff is a code style and formatter
# It works on files in-place
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.7
rev: v0.6.1
hooks:
- id: ruff
args:
Expand Down
9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,16 @@ ignore = [
isort.required-imports = ["from __future__ import annotations"]

[tool.ruff.lint.per-file-ignores]
"tests/**" = [
".github/**" = [
"BLE", # flake8-blind-except
"T20", # flake8-print
]
".github/**" = [
"docs/example/**" = [
"BLE", # flake8-blind-except
"I002", # missing-required-import
"T20", # flake8-print
]
"tests/**" = [
"BLE", # flake8-blind-except
"T20", # flake8-print
]
Expand Down
10 changes: 5 additions & 5 deletions tests/cli/commands/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def list_app() -> Typer:
return APP


@pytest.fixture()
@pytest.fixture
def dotenv_file(tmp_path: Path) -> Path:
"""Create a path to a dotenv file in a temporary test folder."""
from entities_service.service.config import CONFIG
Expand All @@ -53,7 +53,7 @@ def dotenv_file(tmp_path: Path) -> Path:
return tmp_path / env_file


@pytest.fixture()
@pytest.fixture
def _mock_config_base_url(monkeypatch: pytest.MonkeyPatch, live_backend: bool) -> None:
"""Mock the base url if using a live backend."""
if not live_backend:
Expand All @@ -77,7 +77,7 @@ def _mock_config_base_url(monkeypatch: pytest.MonkeyPatch, live_backend: bool) -
)


@pytest.fixture()
@pytest.fixture
def non_mocked_hosts(live_backend: bool) -> list[str]:
"""Return a list of hosts that are not mocked by 'pytest-httpx."""
if not live_backend:
Expand All @@ -104,7 +104,7 @@ def non_mocked_hosts(live_backend: bool) -> list[str]:
return hosts


@pytest.fixture()
@pytest.fixture
def _mock_successful_oauth_response(
monkeypatch: pytest.MonkeyPatch, token_mock: str, httpx_mock: HTTPXMock
) -> None:
Expand All @@ -124,7 +124,7 @@ def _mock_successful_oauth_response(
)


@pytest.fixture()
@pytest.fixture
def _mock_failed_oauth_response(
monkeypatch: pytest.MonkeyPatch, httpx_mock: HTTPXMock
) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/cli/commands/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
pytestmark = pytest.mark.usefixtures("_mock_config_base_url")


@pytest.fixture()
@pytest.fixture
def _prefill_dotenv_config(dotenv_file: Path) -> None:
"""'Pre'-fill the monkeypatched dotenv config paths."""
from dotenv import set_key
Expand Down
6 changes: 3 additions & 3 deletions tests/cli/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from typer.testing import CliRunner


@pytest.fixture()
@pytest.fixture
def cli() -> CliRunner:
"""Fixture for CLI runner."""
import os
Expand All @@ -22,7 +22,7 @@ def cli() -> CliRunner:
return CliRunner(mix_stderr=False, env=os.environ.copy())


@pytest.fixture()
@pytest.fixture
def tmp_cache_dir(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path:
"""Create a temporary cache directory."""
cache_dir = tmp_path / ".cache" / "entities-service"
Expand All @@ -37,7 +37,7 @@ def tmp_cache_dir(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path:
return cache_dir


@pytest.fixture()
@pytest.fixture
def tmp_cache_file(tmp_cache_dir: Path) -> Path:
"""Create a temporary cache file."""
return tmp_cache_dir / "oauth2_token_cache.json"
Expand Down
16 changes: 8 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def _setup_real_mongo_users(
)


@pytest.fixture()
@pytest.fixture
def existing_specific_namespace() -> str:
"""Return the specific namespace to test."""
return "test"
Expand Down Expand Up @@ -632,7 +632,7 @@ def _reset_mongo_test_collections(
)


@pytest.fixture()
@pytest.fixture
def _empty_backend_collection(
get_backend_user: GetBackendUserFixture,
existing_specific_namespace: str,
Expand All @@ -656,7 +656,7 @@ def _empty_backend_collection(
assert backend._collection.count_documents({}) == 0


@pytest.fixture()
@pytest.fixture
def token_mock() -> str:
"""Return a mock token.
Expand All @@ -670,7 +670,7 @@ def token_mock() -> str:
)


@pytest.fixture()
@pytest.fixture
def auth_header(token_mock: str) -> dict[Literal["Authorization"], str]:
"""Return the authentication header."""
from fastapi.security import HTTPAuthorizationCredentials
Expand All @@ -684,7 +684,7 @@ def auth_header(token_mock: str) -> dict[Literal["Authorization"], str]:
}


@pytest.fixture()
@pytest.fixture
def openid_config_mock() -> OpenIDConfigMock:
"""Return a mock OpenID configuration."""

Expand All @@ -705,7 +705,7 @@ def _openid_config_mock(base_url: str) -> dict[str, Any]:
return _openid_config_mock


@pytest.fixture()
@pytest.fixture
def mock_openid_config_call(
httpx_mock: HTTPXMock, openid_config_mock: OpenIDConfigMock
) -> MockOpenIDConfigCall:
Expand All @@ -721,7 +721,7 @@ def _mock_openid_config_call(base_url: str) -> None:
return _mock_openid_config_call


@pytest.fixture()
@pytest.fixture
def mock_auth_verification(
httpx_mock: HTTPXMock,
get_backend_user: GetBackendUserFixture,
Expand Down Expand Up @@ -784,7 +784,7 @@ def _mock_auth_verification(
return _mock_auth_verification


@pytest.fixture()
@pytest.fixture
def client(
live_backend: bool, auth_header: dict[Literal["Authorization"], str]
) -> ClientFixture:
Expand Down
2 changes: 1 addition & 1 deletion tests/service/backend/test_mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __call__(
) -> MongoDBBackend: ...


@pytest.fixture()
@pytest.fixture
def mongo_backend(get_backend_user: GetBackendUserFixture) -> GetMongoBackend:
"""Get a MongoDB backend."""

Expand Down
4 changes: 2 additions & 2 deletions tests/service/test_security.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from ..conftest import MockOpenIDConfigCall, OpenIDConfigMock


@pytest.fixture()
@pytest.fixture
def user_info() -> dict[str, Any]:
"""Test data for verify_user_access_token() function."""
return {
Expand Down Expand Up @@ -46,7 +46,7 @@ def user_info() -> dict[str, Any]:
}


@pytest.fixture()
@pytest.fixture
def group_member_info() -> dict[str, Any]:
"""Test data for verify_user_access_token() function."""
return {
Expand Down

0 comments on commit 7a6e578

Please sign in to comment.