Skip to content

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

Draft
ogenstad wants to merge 1 commit intoinfrahub-developfrom
pog-pytest-stash-migration
Draft

refactor(pytest_plugin): migrate session state to pytest.Stash#985
ogenstad wants to merge 1 commit 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 79.31034% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
infrahub_sdk/pytest_plugin/items/graphql_query.py 33.33% 2 Missing ⚠️
...frahub_sdk/pytest_plugin/items/jinja2_transform.py 33.33% 2 Missing ⚠️
infrahub_sdk/pytest_plugin/items/check.py 50.00% 1 Missing ⚠️
...frahub_sdk/pytest_plugin/items/python_transform.py 66.66% 1 Missing ⚠️
@@                 Coverage Diff                  @@
##           infrahub-develop     #985      +/-   ##
====================================================
+ Coverage             81.43%   81.45%   +0.01%     
====================================================
  Files                   134      135       +1     
  Lines                 11359    11371      +12     
  Branches               1703     1702       -1     
====================================================
+ Hits                   9250     9262      +12     
  Misses                 1566     1566              
  Partials                543      543              
Flag Coverage Δ
integration-tests 41.86% <10.34%> (-0.05%) ⬇️
python-3.10 54.33% <31.03%> (-0.07%) ⬇️
python-3.11 54.34% <31.03%> (-0.07%) ⬇️
python-3.12 54.33% <31.03%> (-0.09%) ⬇️
python-3.13 54.33% <31.03%> (-0.09%) ⬇️
python-3.14 54.32% <31.03%> (-0.07%) ⬇️
python-filler-3.12 22.80% <79.31%> (+0.08%) ⬆️

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 78.37% <100.00%> (ø)
infrahub_sdk/pytest_plugin/loader.py 79.59% <100.00%> (+0.86%) ⬆️
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%) ⬆️
...frahub_sdk/pytest_plugin/items/python_transform.py 61.11% <66.66%> (+0.73%) ⬆️
infrahub_sdk/pytest_plugin/items/graphql_query.py 50.00% <33.33%> (+1.51%) ⬆️
...frahub_sdk/pytest_plugin/items/jinja2_transform.py 60.86% <33.33%> (+0.57%) ⬆️

... and 1 file with indirect coverage changes

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

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