fix: fix assignment-style fixture scope extraction logic#110
Merged
bellini666 merged 1 commit intobellini666:masterfrom Mar 4, 2026
Merged
fix: fix assignment-style fixture scope extraction logic#110bellini666 merged 1 commit intobellini666:masterfrom
bellini666 merged 1 commit intobellini666:masterfrom
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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 innerpytest.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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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