Skip to content

Linting: Incorrect import of pytest; use import pytest instead#824

Merged
ogenstad merged 1 commit intoinfrahub-developfrom
pog-PT013
Feb 13, 2026
Merged

Linting: Incorrect import of pytest; use import pytest instead#824
ogenstad merged 1 commit intoinfrahub-developfrom
pog-PT013

Conversation

@ogenstad
Copy link
Contributor

@ogenstad ogenstad commented Feb 13, 2026

Why

Reduce number of ignored linting rules.

What changed

Use standard approach for pytest imports

Summary by CodeRabbit

  • Refactor
    • Standardized pytest type references across the codebase by consolidating imports and updating type annotations to use the pytest.* namespace, improving consistency and maintainability without affecting functionality.

@coderabbitai
Copy link

coderabbitai bot commented Feb 13, 2026

Walkthrough

This pull request standardizes pytest type annotations across the pytest plugin codebase. Type hints referencing pytest symbols (ExceptionInfo, Item, Parser, Session, Collector, Config, TempPathFactory) have been updated to use the fully-qualified pytest.* namespace instead of direct imports. Import statements were adjusted to import pytest as a module under TYPE_CHECKING blocks where applicable. The pyproject.toml was updated to re-enable the PT013 linting rule. Runtime behavior remains unchanged; only type annotations and import organization were modified.

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.53% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: standardizing pytest imports to use 'import pytest' instead of specific imports, which directly matches the changeset across all modified files.
Description check ✅ Passed The description is minimal but adequately addresses the purpose (reduce linting rules) and the change (use standard pytest imports), though it lacks detail on testing, impact, and procedural checklist items.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into infrahub-develop

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link

Deploying infrahub-sdk-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 54f3a4c
Status: ✅  Deploy successful!
Preview URL: https://bf1c42af.infrahub-sdk-python.pages.dev
Branch Preview URL: https://pog-pt013.infrahub-sdk-python.pages.dev

View logs

@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

❌ Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
infrahub_sdk/pytest_plugin/plugin.py 83.33% 1 Missing ⚠️
@@                 Coverage Diff                  @@
##           infrahub-develop     #824      +/-   ##
====================================================
- Coverage             81.69%   80.57%   -1.12%     
====================================================
  Files                   118      118              
  Lines                 11919    10235    -1684     
  Branches               2047     1538     -509     
====================================================
- Hits                   9737     8247    -1490     
+ Misses                 1553     1457      -96     
+ Partials                629      531      -98     
Flag Coverage Δ
integration-tests 40.39% <0.00%> (-2.73%) ⬇️
python-3.10 51.79% <0.00%> (-2.54%) ⬇️
python-3.11 51.79% <0.00%> (-2.55%) ⬇️
python-3.12 51.79% <0.00%> (-2.55%) ⬇️
python-3.13 51.79% <0.00%> (-2.55%) ⬇️
python-3.14 53.48% <0.00%> (-2.97%) ⬇️
python-filler-3.12 23.97% <92.30%> (+0.30%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
infrahub_sdk/pytest_plugin/items/check.py 43.47% <100.00%> (ø)
infrahub_sdk/pytest_plugin/items/graphql_query.py 48.48% <100.00%> (ø)
...frahub_sdk/pytest_plugin/items/jinja2_transform.py 60.29% <100.00%> (ø)
...frahub_sdk/pytest_plugin/items/python_transform.py 61.53% <100.00%> (ø)
infrahub_sdk/pytest_plugin/loader.py 78.72% <100.00%> (-0.45%) ⬇️
infrahub_sdk/pytest_plugin/plugin.py 84.78% <83.33%> (-0.33%) ⬇️

... and 13 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ogenstad ogenstad marked this pull request as ready for review February 13, 2026 08:43
@ogenstad ogenstad requested a review from a team as a code owner February 13, 2026 08:43
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
infrahub_sdk/pytest_plugin/plugin.py (1)

103-103: ⚠️ Potential issue | 🟡 Minor

Pre-existing typo: "infrahub_integraton" and "Integation".

The marker name and description both have typos — infrahub_integraton (missing 'i') and Integation (missing 'r'). Since this file is already being touched, it would be a good opportunity to fix them.

✏️ Proposed fix
-        "infrahub_integraton: Integation test for an Infrahub resource, depends on an Infrahub running instance",
+        "infrahub_integration: Integration test for an Infrahub resource, depends on an Infrahub running instance",

@ogenstad ogenstad merged commit 8959d12 into infrahub-develop Feb 13, 2026
21 checks passed
@ogenstad ogenstad deleted the pog-PT013 branch February 13, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants