Skip to content
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

feature/add more linters #302

Merged
merged 33 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3ed58e9
add utils for field and type analysis
cutoffthetop Sep 16, 2024
ea3aeef
Merge branch 'main' of https://github.com/robert-koch-institut/mex-co…
cutoffthetop Sep 18, 2024
98f9d19
update types and schemas
cutoffthetop Sep 20, 2024
77565d1
Merge branch 'main' of https://github.com/robert-koch-institut/mex-co…
cutoffthetop Sep 23, 2024
2e8015d
Merge branch 'feature/mx-1702-field-and-type-utils' into feature/mx-1…
cutoffthetop Sep 23, 2024
71803be
Merge branch 'main' into feature/mx-1702-field-and-type-utils
cutoffthetop Sep 24, 2024
c50c477
Merge branch 'feature/mx-1702-field-and-type-utils' into feature/mx-1…
cutoffthetop Sep 24, 2024
7987222
WIP
cutoffthetop Sep 24, 2024
218437e
WIP
cutoffthetop Sep 24, 2024
af73923
fix tests
cutoffthetop Sep 24, 2024
b661613
Merge branch 'main' of https://github.com/robert-koch-institut/mex-co…
cutoffthetop Sep 24, 2024
6220b11
add tests
cutoffthetop Sep 24, 2024
72faee1
update cl
cutoffthetop Sep 24, 2024
b8b7937
fix import
cutoffthetop Sep 24, 2024
78b762c
fix serializer
cutoffthetop Sep 30, 2024
4799be6
update doc
cutoffthetop Sep 30, 2024
fb6b2d0
Merge branch 'main' of https://github.com/robert-koch-institut/mex-co…
cutoffthetop Sep 30, 2024
227a302
clean up vocabs
cutoffthetop Sep 30, 2024
612c7cc
fix url pattern
cutoffthetop Sep 30, 2024
f52bc1c
Merge branch 'main' of https://github.com/robert-koch-institut/mex-co…
cutoffthetop Oct 1, 2024
6c4ab4a
Merge branch 'main' of https://github.com/robert-koch-institut/mex-co…
cutoffthetop Oct 1, 2024
f734ce4
Update tests/types/test_temporal_entity.py
cutoffthetop Oct 10, 2024
dec495a
CL
cutoffthetop Oct 10, 2024
b79c8d9
Merge branch 'feature/mx-1702-type-prep' of https://github.com/robert…
cutoffthetop Oct 10, 2024
2f9ffe6
Merge branch 'main' of https://github.com/robert-koch-institut/mex-co…
cutoffthetop Oct 10, 2024
794f7ab
remove post_models
cutoffthetop Oct 11, 2024
4fd9566
more linters
cutoffthetop Oct 11, 2024
2e1bb20
Merge branch 'main' of https://github.com/robert-koch-institut/mex-co…
cutoffthetop Oct 11, 2024
58cacfc
Merge branch 'main' of https://github.com/robert-koch-institut/mex-co…
cutoffthetop Oct 11, 2024
2a802f4
fix tests
cutoffthetop Oct 11, 2024
b7b4fdf
lint
cutoffthetop Oct 11, 2024
af45812
Merge branch 'main' of https://github.com/robert-koch-institut/mex-co…
cutoffthetop Oct 11, 2024
af9b3c1
CL
cutoffthetop Oct 11, 2024
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
Prev Previous commit
Next Next commit
lint
  • Loading branch information
cutoffthetop committed Oct 11, 2024
commit b7b4fdf0d1337c85edbefd3054c76474ddf67541
2 changes: 1 addition & 1 deletion tests/backend_api/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from mex.common.backend_api.connector import BackendApiConnector


@pytest.fixture()
@pytest.fixture
def mocked_backend(monkeypatch: MonkeyPatch) -> MagicMock:
"""Return the mocked request dispatch method of backend connector."""
mocked_send_request = MagicMock(
Expand Down
8 changes: 4 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
pytest_plugins = ("mex.common.testing.plugin",)


@pytest.fixture()
@pytest.fixture
def extracted_person() -> ExtractedPerson:
"""Return a dummy extracted person for testing purposes."""
return ExtractedPerson.model_construct(
Expand All @@ -45,7 +45,7 @@ def extracted_person() -> ExtractedPerson:
)


@pytest.fixture()
@pytest.fixture
def merged_person() -> MergedPerson:
"""Return a dummy merged person for testing purposes."""
return MergedPerson.model_construct(
Expand All @@ -64,7 +64,7 @@ def merged_person() -> MergedPerson:
)


@pytest.fixture()
@pytest.fixture
def rule_set_request() -> PersonRuleSetRequest:
"""Return a dummy person rule set request for testing purposes."""
return PersonRuleSetRequest(
Expand All @@ -74,7 +74,7 @@ def rule_set_request() -> PersonRuleSetRequest:
)


@pytest.fixture()
@pytest.fixture
def rule_set_response() -> PersonRuleSetResponse:
"""Return a dummy person rule set response for testing purposes."""
return PersonRuleSetResponse(
Expand Down
2 changes: 1 addition & 1 deletion tests/connector/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def _check_availability(self) -> None:
self.request("GET", "_system/check")


@pytest.fixture()
@pytest.fixture
def mocked_dummy_session(monkeypatch: MonkeyPatch) -> MagicMock:
"""Mock the DummyHTTPConnector with a MagicMock session and return that."""
mocked_session = MagicMock(spec=requests.Session, name="dummy_session")
Expand Down
2 changes: 1 addition & 1 deletion tests/ldap/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
}


@pytest.fixture()
@pytest.fixture
def ldap_mocker(monkeypatch: MonkeyPatch) -> LDAPMocker:
"""Patch the LDAP connector to return `SAMPLE_PERSON_ATTRS` from its connection."""

Expand Down
4 changes: 2 additions & 2 deletions tests/ldap/test_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_get_persons_mocked(ldap_mocker: LDAPMocker) -> None:
"nonexistent_person",
],
)
@pytest.mark.integration()
@pytest.mark.integration
def test_get_persons_ldap(kwargs: dict[str, str], pattern: str) -> None:
connector = LDAPConnector.get()
persons = list(connector.get_persons(**kwargs))
Expand All @@ -68,7 +68,7 @@ def test_get_persons_ldap(kwargs: dict[str, str], pattern: str) -> None:
"nonexistent_functional_account",
],
)
@pytest.mark.integration()
@pytest.mark.integration
def test_get_functional_accounts_ldap(kwargs: dict[str, str], pattern: str) -> None:
connector = LDAPConnector.get()
functional_accounts = list(connector.get_functional_accounts(**kwargs))
Expand Down
16 changes: 8 additions & 8 deletions tests/ldap/test_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
from tests.ldap.conftest import SAMPLE_PERSON_ATTRS, LDAPMocker


@pytest.fixture()
@pytest.fixture
def ldap_primary_source(
extracted_primary_sources: dict[str, ExtractedPrimarySource],
) -> ExtractedPrimarySource:
return extracted_primary_sources["ldap"]


@pytest.fixture()
@pytest.fixture
def ldap_person_with_identity(
ldap_primary_source: ExtractedPrimarySource,
) -> LDAPPerson:
Expand All @@ -40,14 +40,14 @@ def ldap_person_with_identity(
return person


@pytest.fixture()
@pytest.fixture
def ldap_person_with_identity_with_query(
ldap_person_with_identity: LDAPPerson,
) -> LDAPPersonWithQuery:
return LDAPPersonWithQuery(person=ldap_person_with_identity, query="foo")


@pytest.fixture()
@pytest.fixture
def ldap_person_without_identity() -> LDAPPerson:
return LDAPPerson(
objectGUID=UUID(int=2, version=4),
Expand All @@ -58,14 +58,14 @@ def ldap_person_without_identity() -> LDAPPerson:
)


@pytest.fixture()
@pytest.fixture
def ldap_person_without_identity_with_query(
ldap_person_without_identity: LDAPPerson,
) -> LDAPPersonWithQuery:
return LDAPPersonWithQuery(person=ldap_person_without_identity, query="foo")


@pytest.fixture()
@pytest.fixture
def ldap_persons(
ldap_person_with_identity: LDAPPerson, ldap_person_without_identity: LDAPPerson
) -> list[LDAPPerson]:
Expand All @@ -75,7 +75,7 @@ def ldap_persons(
]


@pytest.fixture()
@pytest.fixture
def ldap_persons_with_query(
ldap_person_with_identity_with_query: LDAPPersonWithQuery,
ldap_person_without_identity_with_query: LDAPPersonWithQuery,
Expand All @@ -86,7 +86,7 @@ def ldap_persons_with_query(
]


@pytest.fixture()
@pytest.fixture
def merged_id_of_person_with_identity(
ldap_person_with_identity: LDAPPerson,
ldap_primary_source: ExtractedPrimarySource,
Expand Down
2 changes: 1 addition & 1 deletion tests/ldap/test_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from mex.common.testing import Joker


@pytest.fixture()
@pytest.fixture
def extracted_unit(
extracted_primary_sources: dict[str, ExtractedPrimarySource],
) -> ExtractedOrganizationalUnit:
Expand Down
8 changes: 4 additions & 4 deletions tests/organigram/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from mex.common.types import Link, LinkLanguage, Text


@pytest.fixture()
@pytest.fixture
def child_unit() -> OrganigramUnit:
"""Return a child unit corresponding to the test_data."""
return OrganigramUnit(
Expand All @@ -28,7 +28,7 @@ def child_unit() -> OrganigramUnit:
)


@pytest.fixture()
@pytest.fixture
def extracted_child_unit(
child_unit: OrganigramUnit,
extracted_primary_sources: dict[str, ExtractedPrimarySource],
Expand All @@ -41,7 +41,7 @@ def extracted_child_unit(
)


@pytest.fixture()
@pytest.fixture
def parent_unit() -> OrganigramUnit:
"""Return a parent unit corresponding to the test_data."""
return OrganigramUnit(
Expand All @@ -62,7 +62,7 @@ def parent_unit() -> OrganigramUnit:
)


@pytest.fixture()
@pytest.fixture
def extracted_parent_unit(
parent_unit: OrganigramUnit,
extracted_primary_sources: dict[str, ExtractedPrimarySource],
Expand Down
2 changes: 1 addition & 1 deletion tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_settings_getting_caches_singleton() -> None:
assert settings_fetched_again is settings


@pytest.mark.integration()
@pytest.mark.integration
def test_parse_env_file() -> None:
settings = BaseSettings.get()
# "work_dir" and "assets_dir" are always set, assert that more than these two are
Expand Down
2 changes: 1 addition & 1 deletion tests/types/test_vocabulary.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_split_to_caps(string: str, expected: str) -> None:
assert split_to_caps(string) == expected


@pytest.fixture()
@pytest.fixture
def use_dummy_vocabulary(monkeypatch: MonkeyPatch) -> None:
dummy_vocabulary = VocabularyLoader.parse_file(
str(TESTDATA_DIR / "dummy-vocabulary.json")
Expand Down
4 changes: 2 additions & 2 deletions tests/wikidata/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
TESTDATA_DIR = Path(__file__).parent / "test_data"


@pytest.fixture()
@pytest.fixture
def mocked_session_wikidata_query_service(monkeypatch: MonkeyPatch) -> MagicMock:
"""Mock and return WikidataQueryServiceConnector with a MagicMock session."""
mocked_session = MagicMock(spec=requests.Session)
Expand All @@ -25,7 +25,7 @@ def __init__(self: WikidataQueryServiceConnector) -> None:
return mocked_session


@pytest.fixture()
@pytest.fixture
def mocked_session_wikidata_api(monkeypatch: MonkeyPatch) -> MagicMock:
"""Mock and return WikidataAPIConnector with a MagicMock session."""
mocked_session = MagicMock(spec=requests.Session)
Expand Down
4 changes: 2 additions & 2 deletions tests/wikidata/test_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_initialization_mocked_server(
assert connector._check_availability() is None


@pytest.mark.integration()
@pytest.mark.integration
def test_get_data_by_query() -> None:
"""Test if items can be searched providing a label."""
expected = [
Expand Down Expand Up @@ -110,7 +110,7 @@ def test_get_data_by_query_mocked(
assert response == expected


@pytest.mark.integration()
@pytest.mark.integration
def test_get_wikidata_item_details_by_id() -> None:
"""Test if items details can be fetched by its ID."""
connector = WikidataAPIConnector.get()
Expand Down
2 changes: 1 addition & 1 deletion tests/wikidata/test_convenience.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_get_merged_organization_id_by_query_with_extract_transform_and_load_moc
load_function.assert_not_called()


@pytest.mark.integration()
@pytest.mark.integration
def test_get_merged_organization_id_by_query_with_extract_transform_and_load(
extracted_primary_sources: dict[str, ExtractedPrimarySource],
) -> None:
Expand Down
10 changes: 5 additions & 5 deletions tests/wikidata/test_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from tests.wikidata.conftest import TESTDATA_DIR


@pytest.mark.integration()
@pytest.mark.integration
def test_search_organization_by_label() -> None:
expected = "Q679041"

Expand All @@ -29,7 +29,7 @@ def test_search_organization_by_label() -> None:
assert search_result.identifier == expected


@pytest.mark.integration()
@pytest.mark.integration
def test_search_organizations_by_label() -> None:
search_result = list(
search_organizations_by_label(
Expand All @@ -50,7 +50,7 @@ def test_search_organizations_by_label() -> None:
assert search_result[0].labels.model_dump() == labels


@pytest.mark.integration()
@pytest.mark.integration
def test_get_count_of_found_organizations_by_label() -> None:
total_found_orgs = get_count_of_found_organizations_by_label(
item_label='Robert Koch Institute"',
Expand All @@ -60,7 +60,7 @@ def test_get_count_of_found_organizations_by_label() -> None:
assert total_found_orgs == 3


@pytest.mark.integration()
@pytest.mark.integration
def test_search_organization_by_label_for_none() -> None:
"""Test if None is returned when multiple organizations are found."""
search_result = search_organization_by_label(
Expand Down Expand Up @@ -425,7 +425,7 @@ def mocked_query_response() -> list[dict[str, dict[str, str]]]:
assert search_result == 3


@pytest.mark.integration()
@pytest.mark.integration
def test_get_organization_details() -> None:
expected = {
"identifier": "Q679041",
Expand Down
Loading