Skip to content

fix: fix assignment-style fixture scope extraction logic#110

Merged
bellini666 merged 1 commit intobellini666:masterfrom
benediktziegler:fix-scope-detection
Mar 4, 2026
Merged

fix: fix assignment-style fixture scope extraction logic#110
bellini666 merged 1 commit intobellini666:masterfrom
benediktziegler:fix-scope-detection

Conversation

@benediktziegler
Copy link
Contributor

Add tests for assignment-style fixture scopes (function, class, module, package, session) to ensure correct detection and defaulting behavior. Fix assignment-style fixture scope extraction logic

Add tests for assignment-style fixture scope detection, covering all supported scopes and default behavior.

Fixes #109

Add tests for assignment-style fixture scopes (function, class, module,
package, session) to ensure correct detection and defaulting behavior.
Fix assignment-style fixture scope extraction logic

Add tests for assignment-style fixture scope detection, covering all
supported scopes and default behavior.
@codecov
Copy link

codecov bot commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.68%. Comparing base (fcd530a) to head (839e233).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #110      +/-   ##
==========================================
+ Coverage   63.18%   63.68%   +0.50%     
==========================================
  Files          26       26              
  Lines        3393     3393              
==========================================
+ Hits         2144     2161      +17     
+ Misses       1249     1232      -17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes incorrect scope detection for assignment-style pytest fixtures (e.g., name = pytest.fixture(scope="class")(func)) in the fixture analyzer, and adds targeted regression tests to cover default and explicit scopes.

Changes:

  • Update assignment-style fixture extraction to read scope=... from the inner pytest.fixture(...) call, defaulting to function scope when absent.
  • Add tests covering assignment-style fixtures for default scope and all supported explicit scopes (class/module/package/session), including a combined “all scopes together” case.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/fixtures/analyzer.rs Fixes assignment-style fixture scope extraction by reusing the existing decorator scope parser.
tests/test_fixtures.rs Adds regression tests to ensure assignment-style fixture scopes are detected and defaulted correctly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Owner

@bellini666 bellini666 left a comment

Choose a reason for hiding this comment

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

Nice! :)

@bellini666 bellini666 merged commit bbf5ce7 into bellini666:master Mar 4, 2026
18 checks passed
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.

Wrong scope detection for inline declaration of fixtures

3 participants