Skip to content

refactor(pytest_plugin): migrate session state to pytest.Stash#985

Draft
ogenstad wants to merge 2 commits intoinfrahub-developfrom
pog-pytest-stash-migration
Draft

refactor(pytest_plugin): migrate session state to pytest.Stash#985
ogenstad wants to merge 2 commits intoinfrahub-developfrom
pog-pytest-stash-migration

Conversation

@ogenstad
Copy link
Copy Markdown
Contributor

Why

Found when analyzing the codebase for areas where we could improve typing. Use a new pytest.Stash feature to allow for correct typing within our pytest plugin

What changed

  • Migrate the pytest plugin's session state from dynamic attribute assignment to pytest.StashKey

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

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

Files with missing lines Patch % Lines
infrahub_sdk/pytest_plugin/items/check.py 50.00% 1 Missing ⚠️
@@                 Coverage Diff                  @@
##           infrahub-develop     #985      +/-   ##
====================================================
+ Coverage             81.43%   81.85%   +0.42%     
====================================================
  Files                   134      135       +1     
  Lines                 11359    11371      +12     
  Branches               1703     1702       -1     
====================================================
+ Hits                   9250     9308      +58     
+ Misses                 1566     1512      -54     
- Partials                543      551       +8     
Flag Coverage Δ
integration-tests 41.86% <10.34%> (-0.05%) ⬇️
python-3.10 54.74% <48.27%> (+0.32%) ⬆️
python-3.11 54.74% <48.27%> (+0.32%) ⬆️
python-3.12 54.74% <48.27%> (+0.34%) ⬆️
python-3.13 54.76% <48.27%> (+0.34%) ⬆️
python-3.14 54.75% <48.27%> (+0.36%) ⬆️
python-filler-3.12 23.51% <96.55%> (+0.79%) ⬆️

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

Files with missing lines Coverage Δ
infrahub_sdk/pytest_plugin/_stash.py 100.00% <100.00%> (ø)
infrahub_sdk/pytest_plugin/items/base.py 89.18% <100.00%> (+10.81%) ⬆️
infrahub_sdk/pytest_plugin/items/graphql_query.py 70.58% <100.00%> (+22.10%) ⬆️
...frahub_sdk/pytest_plugin/items/jinja2_transform.py 71.01% <100.00%> (+10.72%) ⬆️
...frahub_sdk/pytest_plugin/items/python_transform.py 68.51% <100.00%> (+8.14%) ⬆️
infrahub_sdk/pytest_plugin/loader.py 91.83% <100.00%> (+13.11%) ⬆️
infrahub_sdk/pytest_plugin/plugin.py 84.44% <100.00%> (-0.34%) ⬇️
infrahub_sdk/pytest_plugin/items/check.py 44.68% <50.00%> (+1.20%) ⬆️

... and 3 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 force-pushed the pog-pytest-stash-migration branch from ea45dd4 to 4513b43 Compare May 7, 2026 11:30
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 7, 2026

Deploying infrahub-sdk-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4513b43
Status: ✅  Deploy successful!
Preview URL: https://24287c14.infrahub-sdk-python.pages.dev
Branch Preview URL: https://pog-pytest-stash-migration.infrahub-sdk-python.pages.dev

View logs

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.

1 participant