-
Notifications
You must be signed in to change notification settings - Fork 6
Fix test annotations on unit tests #720
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
Conversation
Walkthroughpyproject.toml edits remove "input" from the Ruff builtins ignorelist and delete numerous per-file lint-ignore entries for test files. Multiple test modules under tests/unit/sdk/ were modified to add type annotations to function parameters, introduce TYPE_CHECKING blocks for conditional imports, and import new typing symbols. tests/unit/sdk/test_utils.py adds a dataclass ValidURLTestCase and VALID_URL_TEST_CASES and refactors a parametrized test. One test adds an extra assertion checking an initial commit message. Pre-merge checks❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying infrahub-sdk-python with
|
| Latest commit: |
1506d95
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2d29725a.infrahub-sdk-python.pages.dev |
| Branch Preview URL: | https://pog-unit-test-annotations.infrahub-sdk-python.pages.dev |
| [pytest.param(tc, id=str(tc.input)) for tc in VALID_URL_TEST_CASES], | ||
| ) | ||
| def test_is_valid_url(input, result) -> None: | ||
| assert is_valid_url(input) is result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored this to get rid of the shadowing of the builtin input() function, and the need to have Any as input in a function signature.
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## infrahub-develop #720 +/- ##
====================================================
+ Coverage 76.28% 76.29% +0.01%
====================================================
Files 114 114
Lines 9831 9831
Branches 1509 1509
====================================================
+ Hits 7500 7501 +1
+ Misses 1837 1834 -3
- Partials 494 496 +2
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
tests/unit/sdk/test_utils.py (1)
52-68: Consider renaming the dataclass field and using a more specific type.The
inputfield name andAnytype annotation may conflict with the previous refactoring goal mentioned in the past review comment (line 65), which aimed to eliminate shadowing of the builtininput()function and avoidAnyin signatures. While this is now a dataclass field rather than a function parameter, consider:
- Renaming
inputto something likeurl_inputortest_inputto avoid any shadowing concerns- Using
str | intinstead ofAnysince all test cases use either str or int values🔎 Proposed refinement
@dataclass class ValidURLTestCase: - input: Any + url_input: str | int result: bool VALID_URL_TEST_CASES = [ - ValidURLTestCase(input=55, result=False), - ValidURLTestCase(input="https://", result=False), + ValidURLTestCase(url_input=55, result=False), + ValidURLTestCase(url_input="https://", result=False), # ... update remaining test cases ] @pytest.mark.parametrize( "test_case", - [pytest.param(tc, id=str(tc.input)) for tc in VALID_URL_TEST_CASES], + [pytest.param(tc, id=str(tc.url_input)) for tc in VALID_URL_TEST_CASES], ) def test_is_valid_url(test_case: ValidURLTestCase) -> None: - assert is_valid_url(test_case.input) is test_case.result + assert is_valid_url(test_case.url_input) is test_case.resulttests/unit/sdk/test_repository.py (1)
68-68: Minor test enhancement beyond annotation fixes.While the PR focuses on fixing test annotations, this line adds a new assertion validating the commit message. This is a minor but reasonable test improvement that strengthens the test coverage for repository initialization.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (13)
pyproject.tomltests/unit/sdk/checks/test_checks.pytests/unit/sdk/graphql/test_renderer.pytests/unit/sdk/test_batch.pytests/unit/sdk/test_branch.pytests/unit/sdk/test_group_context.pytests/unit/sdk/test_protocols_generator.pytests/unit/sdk/test_query_analyzer.pytests/unit/sdk/test_repository.pytests/unit/sdk/test_schema_sorter.pytests/unit/sdk/test_store_branch.pytests/unit/sdk/test_timestamp.pytests/unit/sdk/test_utils.py
💤 Files with no reviewable changes (1)
- pyproject.toml
🧰 Additional context used
📓 Path-based instructions (3)
**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
**/*.py: Use type hints on all function signatures
Never mix async/sync inappropriately
Never bypass type checking without justification
Files:
tests/unit/sdk/test_timestamp.pytests/unit/sdk/test_repository.pytests/unit/sdk/test_schema_sorter.pytests/unit/sdk/test_group_context.pytests/unit/sdk/checks/test_checks.pytests/unit/sdk/test_store_branch.pytests/unit/sdk/test_batch.pytests/unit/sdk/test_protocols_generator.pytests/unit/sdk/test_branch.pytests/unit/sdk/test_utils.pytests/unit/sdk/test_query_analyzer.pytests/unit/sdk/graphql/test_renderer.py
tests/**/*.py
📄 CodeRabbit inference engine (tests/AGENTS.md)
tests/**/*.py: Usehttpx_mockfixture for HTTP mocking in tests instead of making real HTTP requests
Do not add@pytest.mark.asynciodecorator to async test functions (async auto-mode is globally enabled)
Files:
tests/unit/sdk/test_timestamp.pytests/unit/sdk/test_repository.pytests/unit/sdk/test_schema_sorter.pytests/unit/sdk/test_group_context.pytests/unit/sdk/checks/test_checks.pytests/unit/sdk/test_store_branch.pytests/unit/sdk/test_batch.pytests/unit/sdk/test_protocols_generator.pytests/unit/sdk/test_branch.pytests/unit/sdk/test_utils.pytests/unit/sdk/test_query_analyzer.pytests/unit/sdk/graphql/test_renderer.py
tests/unit/**/*.py
📄 CodeRabbit inference engine (tests/AGENTS.md)
Unit tests must be fast, mocked, and have no external dependencies
Files:
tests/unit/sdk/test_timestamp.pytests/unit/sdk/test_repository.pytests/unit/sdk/test_schema_sorter.pytests/unit/sdk/test_group_context.pytests/unit/sdk/checks/test_checks.pytests/unit/sdk/test_store_branch.pytests/unit/sdk/test_batch.pytests/unit/sdk/test_protocols_generator.pytests/unit/sdk/test_branch.pytests/unit/sdk/test_utils.pytests/unit/sdk/test_query_analyzer.pytests/unit/sdk/graphql/test_renderer.py
🧠 Learnings (4)
📚 Learning: 2025-12-10T17:13:37.990Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: tests/AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:37.990Z
Learning: Applies to tests/**/*.py : Use `httpx_mock` fixture for HTTP mocking in tests instead of making real HTTP requests
Applied to files:
tests/unit/sdk/test_schema_sorter.pytests/unit/sdk/checks/test_checks.pytests/unit/sdk/test_protocols_generator.py
📚 Learning: 2025-12-10T17:13:08.136Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:08.136Z
Learning: Applies to infrahub_sdk/client.py : Always provide both async and sync versions of client implementations in InfrahubClient
Applied to files:
tests/unit/sdk/checks/test_checks.pytests/unit/sdk/test_branch.py
📚 Learning: 2025-12-10T17:13:08.136Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:08.136Z
Learning: Applies to infrahub_sdk/**/*.py : Follow async/sync dual pattern for new features in the Python SDK
Applied to files:
tests/unit/sdk/test_branch.py
📚 Learning: 2025-12-10T17:13:08.136Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:08.136Z
Learning: Applies to **/*.py : Use type hints on all function signatures
Applied to files:
tests/unit/sdk/graphql/test_renderer.py
🧬 Code graph analysis (11)
tests/unit/sdk/test_repository.py (1)
infrahub_sdk/repository.py (2)
GitRepoManager(9-32)active_branch(31-32)
tests/unit/sdk/test_schema_sorter.py (2)
infrahub_sdk/transfer/schema_sorter.py (1)
InfrahubSchemaTopologicalSorter(13-33)tests/unit/sdk/conftest.py (1)
mock_schema_query_01(1815-1822)
tests/unit/sdk/test_group_context.py (2)
infrahub_sdk/schema/main.py (1)
NodeSchemaAPI(312-314)tests/unit/sdk/conftest.py (3)
replace_sync_return_annotation(121-128)replace_async_return_annotation(95-101)std_group_schema(291-301)
tests/unit/sdk/checks/test_checks.py (2)
tests/unit/sdk/conftest.py (1)
client(32-33)tests/unit/sdk/checks/conftest.py (1)
mock_gql_query_my_query(13-22)
tests/unit/sdk/test_store_branch.py (3)
infrahub_sdk/schema/main.py (1)
NodeSchemaAPI(312-314)infrahub_sdk/store.py (1)
NodeStoreBranch(25-189)tests/unit/sdk/conftest.py (1)
schema_with_hfid(226-287)
tests/unit/sdk/test_batch.py (1)
tests/unit/sdk/conftest.py (2)
mock_query_mutation_location_create_failed(2152-2169)mock_schema_query_01(1815-1822)
tests/unit/sdk/test_protocols_generator.py (1)
tests/unit/sdk/conftest.py (2)
client(32-33)mock_schema_query_05(1843-1850)
tests/unit/sdk/test_branch.py (1)
tests/unit/sdk/conftest.py (3)
BothClients(25-28)clients(42-46)mock_branches_list_query(1429-1465)
tests/unit/sdk/test_utils.py (2)
infrahub_sdk/utils.py (1)
is_valid_url(215-227)tests/unit/sdk/conftest.py (2)
query_01(2186-2209)query_02(2213-2254)
tests/unit/sdk/test_query_analyzer.py (1)
tests/unit/sdk/conftest.py (2)
query_01(2186-2209)bad_query_01(2375-2395)
tests/unit/sdk/graphql/test_renderer.py (1)
tests/unit/sdk/graphql/conftest.py (4)
query_data_no_filter(18-25)query_data_alias(29-36)query_data_fragment(40-49)input_data_01(94-103)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (17)
tests/unit/sdk/test_timestamp.py (1)
66-66: LGTM! Type annotations correctly added to parametrized test functions.The type hints for
input_str,expected_datetime,expected_str,expected_str_no_z, andinvalid_strare accurate and align with the test parameter values.Also applies to: 88-88, 132-132
tests/unit/sdk/test_protocols_generator.py (2)
2-2: LGTM! Proper use of TYPE_CHECKING guard.The TYPE_CHECKING import guard correctly avoids runtime imports while providing type hints for static analysis.
Also applies to: 9-11
48-48: LGTM! Correct forward reference type annotation.The
"HTTPXMock"forward reference string is the correct approach when the type is only imported under TYPE_CHECKING.tests/unit/sdk/test_utils.py (1)
170-170: LGTM! Type annotations correctly added to test functions.The
query_01: strandquery_02: strannotations are accurate and match the fixture return types.Also applies to: 185-185
tests/unit/sdk/graphql/test_renderer.py (2)
1-2: LGTM! Proper import addition.The
Anyimport is necessary for thedict[str, Any]type annotations added to test functions.
6-6: LGTM! Type annotations correctly added.The
dict[str, Any]annotations forquery_data_no_filter,query_data_alias,query_data_fragment, andinput_data_01are accurate and match the fixture return types.Also applies to: 49-49, 71-71, 95-95
tests/unit/sdk/checks/test_checks.py (2)
2-2: LGTM! Proper TYPE_CHECKING guard usage.The TYPE_CHECKING pattern correctly avoids runtime imports while enabling static type checking.
Also applies to: 9-11
43-43: LGTM! Type annotations correctly added.The annotations for
client: InfrahubClientandmock_gql_query_my_query: "HTTPXMock"are accurate. The forward reference string is the correct approach for TYPE_CHECKING imports.Also applies to: 51-51
tests/unit/sdk/test_branch.py (3)
1-2: LGTM! Proper use of postponed annotations.The
from __future__ import annotationsenables PEP 563 postponed evaluation, allowing cleaner type hints without forward reference strings.
4-4: LGTM! Proper TYPE_CHECKING guard usage.The TYPE_CHECKING pattern correctly imports
HTTPXMockandBothClientsfor type checking without runtime overhead.Also applies to: 14-18
32-32: LGTM! Type annotations correctly added.The annotations for
method: str,clients: BothClients,mock_branches_list_query: HTTPXMock, andclient_type: strare accurate and leverage the postponed annotations from__future__import.Also applies to: 42-42
tests/unit/sdk/test_batch.py (1)
51-57: LGTM! Type annotations correctly added.The
HTTPXMockannotations formock_query_mutation_location_create_failedandmock_schema_query_01in bothtest_batch_return_exceptionandtest_batch_exceptionare accurate and consistent with the existing TYPE_CHECKING pattern in this file.Also applies to: 97-103
tests/unit/sdk/test_query_analyzer.py (1)
8-8: LGTM! Type annotations correctly added.The type hints for
query_01: str,bad_query_01: str,var_type: str, andvar_required: boolare accurate and align with the corresponding fixture return types and parametrize values.Also applies to: 154-154
tests/unit/sdk/test_repository.py (1)
20-20: LGTM! Type annotations improve test type safety.The explicit type annotations on all test function parameters are correct and align with the coding guidelines requiring type hints on all function signatures.
Also applies to: 32-32, 43-43, 51-51, 63-63
tests/unit/sdk/test_group_context.py (1)
2-2: LGTM! Type annotations are correctly applied.The type annotations accurately reflect the fixture definitions:
Callable[[str], str]matches the return type of the replacement annotation fixturesNodeSchemaAPImatches the std_group_schema fixture typeThe necessary imports are correctly added, and the annotations improve type safety without affecting test behavior.
Also applies to: 7-7, 23-25, 72-72
tests/unit/sdk/test_store_branch.py (1)
6-6: LGTM! Type annotations correctly match fixture definitions.The
NodeSchemaAPItype annotations accurately reflect the fixture return types:
schema_with_hfidfixture returnsdict[str, NodeSchemaAPI]location_schemafixture returnsNodeSchemaAPIThese annotations improve type checking without any functional changes.
Also applies to: 10-10, 26-26, 43-43, 69-69
tests/unit/sdk/test_schema_sorter.py (1)
1-1: LGTM! Proper use of TYPE_CHECKING pattern.The
TYPE_CHECKINGguard correctly avoids runtime imports while enabling static type checking:
HTTPXMockis imported only during type checking- Forward reference
"HTTPXMock"is properly used in the function signature- The annotation matches the
mock_schema_query_01fixture return typeThis pattern reduces runtime overhead while improving type safety.
Also applies to: 6-8, 10-10
tests/unit/sdk/checks/test_checks.py
Outdated
|
|
||
|
|
||
| async def test_validate_sync_async(mock_gql_query_my_query) -> None: | ||
| async def test_validate_sync_async(mock_gql_query_my_query: "HTTPXMock") -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to quote the type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. It was just missing the from __future__ import annotations statement. I've removed the quotes.
36cf741 to
1506d95
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/unit/sdk/checks/test_checks.py (1)
1-13: Consider removing unnecessary quotes for consistency.With
from __future__ import annotations, all type annotations are automatically converted to strings at runtime, so the explicit quotes around"HTTPXMock"on Line 53 are unnecessary. Other files in this PR (test_branch.py, test_batch.py) usefrom __future__ import annotationswithout quoting types under TYPE_CHECKING.For consistency, you could remove the quotes on Line 53.
🔎 Proposed consistency fix
On Line 53:
-async def test_validate_sync_async(mock_gql_query_my_query: "HTTPXMock") -> None: +async def test_validate_sync_async(mock_gql_query_my_query: HTTPXMock) -> None:
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (13)
pyproject.tomltests/unit/sdk/checks/test_checks.pytests/unit/sdk/graphql/test_renderer.pytests/unit/sdk/test_batch.pytests/unit/sdk/test_branch.pytests/unit/sdk/test_group_context.pytests/unit/sdk/test_protocols_generator.pytests/unit/sdk/test_query_analyzer.pytests/unit/sdk/test_repository.pytests/unit/sdk/test_schema_sorter.pytests/unit/sdk/test_store_branch.pytests/unit/sdk/test_timestamp.pytests/unit/sdk/test_utils.py
💤 Files with no reviewable changes (1)
- pyproject.toml
🚧 Files skipped from review as they are similar to previous changes (3)
- tests/unit/sdk/test_query_analyzer.py
- tests/unit/sdk/test_timestamp.py
- tests/unit/sdk/test_group_context.py
🧰 Additional context used
📓 Path-based instructions (3)
**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
**/*.py: Use type hints on all function signatures
Never mix async/sync inappropriately
Never bypass type checking without justification
Files:
tests/unit/sdk/test_protocols_generator.pytests/unit/sdk/test_batch.pytests/unit/sdk/test_store_branch.pytests/unit/sdk/test_schema_sorter.pytests/unit/sdk/test_branch.pytests/unit/sdk/graphql/test_renderer.pytests/unit/sdk/test_utils.pytests/unit/sdk/checks/test_checks.pytests/unit/sdk/test_repository.py
tests/**/*.py
📄 CodeRabbit inference engine (tests/AGENTS.md)
tests/**/*.py: Usehttpx_mockfixture for HTTP mocking in tests instead of making real HTTP requests
Do not add@pytest.mark.asynciodecorator to async test functions (async auto-mode is globally enabled)
Files:
tests/unit/sdk/test_protocols_generator.pytests/unit/sdk/test_batch.pytests/unit/sdk/test_store_branch.pytests/unit/sdk/test_schema_sorter.pytests/unit/sdk/test_branch.pytests/unit/sdk/graphql/test_renderer.pytests/unit/sdk/test_utils.pytests/unit/sdk/checks/test_checks.pytests/unit/sdk/test_repository.py
tests/unit/**/*.py
📄 CodeRabbit inference engine (tests/AGENTS.md)
Unit tests must be fast, mocked, and have no external dependencies
Files:
tests/unit/sdk/test_protocols_generator.pytests/unit/sdk/test_batch.pytests/unit/sdk/test_store_branch.pytests/unit/sdk/test_schema_sorter.pytests/unit/sdk/test_branch.pytests/unit/sdk/graphql/test_renderer.pytests/unit/sdk/test_utils.pytests/unit/sdk/checks/test_checks.pytests/unit/sdk/test_repository.py
🧠 Learnings (7)
📚 Learning: 2025-12-10T17:13:37.990Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: tests/AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:37.990Z
Learning: Applies to tests/**/*.py : Use `httpx_mock` fixture for HTTP mocking in tests instead of making real HTTP requests
Applied to files:
tests/unit/sdk/test_protocols_generator.pytests/unit/sdk/test_schema_sorter.pytests/unit/sdk/checks/test_checks.py
📚 Learning: 2025-12-10T17:13:08.136Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:08.136Z
Learning: Applies to infrahub_sdk/client.py : Always provide both async and sync versions of client implementations in InfrahubClient
Applied to files:
tests/unit/sdk/test_branch.pytests/unit/sdk/checks/test_checks.py
📚 Learning: 2025-12-10T17:13:08.136Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:08.136Z
Learning: Applies to infrahub_sdk/**/*.py : Follow async/sync dual pattern for new features in the Python SDK
Applied to files:
tests/unit/sdk/test_branch.py
📚 Learning: 2025-12-10T17:13:08.136Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:08.136Z
Learning: Applies to **/*.py : Use type hints on all function signatures
Applied to files:
tests/unit/sdk/checks/test_checks.py
📚 Learning: 2025-12-10T17:13:29.593Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: infrahub_sdk/pytest_plugin/AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:29.593Z
Learning: Applies to infrahub_sdk/pytest_plugin/**/infrahub_sdk/pytest_plugin/items/*.py : Inherit from `InfrahubItem` base class when creating new test item classes in `infrahub_sdk/pytest_plugin/items/`
Applied to files:
tests/unit/sdk/checks/test_checks.py
📚 Learning: 2025-12-10T17:13:37.990Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: tests/AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:37.990Z
Learning: Applies to tests/integration/**/*.py : Integration tests should use testcontainers to interact with real Infrahub instances
Applied to files:
tests/unit/sdk/checks/test_checks.py
📚 Learning: 2025-12-10T17:13:29.593Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: infrahub_sdk/pytest_plugin/AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:29.593Z
Learning: Applies to infrahub_sdk/pytest_plugin/**/*.yaml : Use YAML test format with required fields: `infrahub_tests`, `resource`, `resource_name`, `tests` array containing `name`, `spec.kind`, `input`, and `output`
Applied to files:
tests/unit/sdk/checks/test_checks.py
🧬 Code graph analysis (8)
tests/unit/sdk/test_protocols_generator.py (1)
tests/unit/sdk/conftest.py (2)
client(32-33)mock_schema_query_05(1843-1850)
tests/unit/sdk/test_batch.py (1)
tests/unit/sdk/conftest.py (2)
mock_query_mutation_location_create_failed(2152-2169)mock_schema_query_01(1815-1822)
tests/unit/sdk/test_store_branch.py (3)
infrahub_sdk/schema/main.py (1)
NodeSchemaAPI(312-314)infrahub_sdk/store.py (1)
NodeStoreBranch(25-189)tests/unit/sdk/conftest.py (2)
schema_with_hfid(226-287)location_schema(148-180)
tests/unit/sdk/test_schema_sorter.py (2)
infrahub_sdk/transfer/schema_sorter.py (1)
InfrahubSchemaTopologicalSorter(13-33)tests/unit/sdk/conftest.py (1)
mock_schema_query_01(1815-1822)
tests/unit/sdk/test_branch.py (1)
tests/unit/sdk/conftest.py (3)
BothClients(25-28)clients(42-46)mock_branches_list_query(1429-1465)
tests/unit/sdk/graphql/test_renderer.py (2)
infrahub_sdk/graphql/renderers.py (2)
render_input_block(156-216)render_query_block(87-153)tests/unit/sdk/graphql/conftest.py (4)
query_data_no_filter(18-25)query_data_alias(29-36)query_data_fragment(40-49)input_data_01(94-103)
tests/unit/sdk/test_utils.py (2)
infrahub_sdk/utils.py (1)
is_valid_url(215-227)tests/unit/sdk/conftest.py (2)
query_01(2186-2209)query_02(2213-2254)
tests/unit/sdk/checks/test_checks.py (2)
tests/unit/sdk/conftest.py (1)
client(32-33)tests/unit/sdk/checks/conftest.py (1)
mock_gql_query_my_query(13-22)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: unit-tests (3.10)
- GitHub Check: unit-tests (3.12)
- GitHub Check: unit-tests (3.11)
- GitHub Check: unit-tests (3.14)
- GitHub Check: unit-tests (3.13)
- GitHub Check: integration-tests-latest-infrahub
- GitHub Check: Cloudflare Pages
🔇 Additional comments (13)
tests/unit/sdk/graphql/test_renderer.py (5)
1-1: LGTM! Import added correctly.The
Anyimport is necessary for thedict[str, Any]type hints added throughout the file.
6-6: LGTM! Type annotations added correctly.The type hint correctly matches the fixture's return type from conftest.py. This aligns with the coding guideline to use type hints on all function signatures.
49-49: LGTM! Type annotations added correctly.The type hint correctly matches the fixture's return type and maintains consistency with the other test functions in the file.
71-71: LGTM! Type annotations added correctly.The type hint correctly matches the fixture's return type and maintains consistency with the other test functions in the file.
95-95: LGTM! Type annotations added correctly.The type hint correctly matches the fixture's return type and maintains consistency with the other test functions in the file.
tests/unit/sdk/test_protocols_generator.py (1)
2-11: LGTM! Correct use of TYPE_CHECKING guard.The TYPE_CHECKING guard correctly prevents runtime import of HTTPXMock, and the quoted type hint on Line 48 is necessary since
from __future__ import annotationsis not used.tests/unit/sdk/test_store_branch.py (1)
6-6: LGTM! Proper type annotations added.The NodeSchemaAPI import and type hints correctly annotate test parameters, improving type safety without affecting runtime behavior.
tests/unit/sdk/test_branch.py (1)
1-18: LGTM! Proper typing enhancements.The use of
from __future__ import annotationswith TYPE_CHECKING guards is correctly implemented, and type hints are consistently applied without unnecessary quotes.tests/unit/sdk/test_schema_sorter.py (1)
1-10: LGTM! Correct TYPE_CHECKING pattern.The quoted type hint is necessary since
from __future__ import annotationsis not used, preventing NameError at runtime while maintaining type checking support.tests/unit/sdk/test_utils.py (2)
52-76: Excellent refactoring!The introduction of
ValidURLTestCasedataclass and structured test cases improves the test code by:
- Eliminating shadowing of the builtin
inputfunction- Providing clear, explicit test case definitions
- Making test data more maintainable and self-documenting
170-185: LGTM! Type hints added correctly.The type annotations for the fixture parameters improve type safety and code clarity.
tests/unit/sdk/test_repository.py (1)
20-68: LGTM! Type annotations and test coverage improvements.The type hints are correctly added to all test functions, and the additional assertion on Line 68 provides valuable verification of the initial commit message.
tests/unit/sdk/test_batch.py (1)
51-100: LGTM! Consistent typing approach.The HTTPXMock type hints are correctly applied without quotes, consistent with the use of
from __future__ import annotations. The changes improve type safety without affecting test behavior.
Summary by CodeRabbit
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.