Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit hooks
Browse files Browse the repository at this point in the history
For more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 19, 2024
1 parent 9903deb commit b7839dd
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 20 deletions.
2 changes: 2 additions & 0 deletions docs/example/dlite_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
}
],
"source": [
"from __future__ import annotations\n",
"\n",
"from dlite_example import get_instance\n",
"\n",
"instance = get_instance(\"http://onto-ns.com/meta/1.0/OPTIMADEStructure\")\n",
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 b7839dd

Please sign in to comment.