deadfixture doesn't support pytest-lazy-fixture
See original GitHub issueThe pytest-lazy-fixture plugin makes possible to use a fixtures inside pytest.mark.parametrize
:
@pytest.fixture(params=[1, 2])
def one(request):
return request.param
@pytest.mark.parametrize('arg1,arg2', [
('val1', pytest.lazy_fixture('one')),
])
def test_func(arg1, arg2):
assert arg2 in [1, 2]
In this example, deadfixtures
doesn’t detect the fixture one
being used and returns the warning.
Ref: There is a proposal in Pytest to make this behaviour possible out of the box: https://docs.pytest.org/en/latest/proposals/parametrize_with_fixtures.html
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Tests are not executed when using --dead-fixtures #20 - GitHub
It seams that this plugin breaks something related with the tests count. As we can clearly see that 16 tests were collected, but...
Read more >pytest Documentation - Read the Docs
Fixture functions can accept the request object to introspect the “requesting” test function, class or module context.
Read more >pytest: Expand test inputs using dynamic fixtures
We are going to see how to generate test inputs with the Python testing framework pytest, and how to customize the results using...
Read more >Why does logging with pytest parametrize return lines in ...
I have defined initializeLogger(self) as a pytest fixture which is initialized before my main test function: test_ZeroI(..) is called. The ...
Read more >90 - Dynamic Scope Fixtures in pytest 5.2 - Anthony Sottile
Sort of. It's not guaranteed to be that way. If some of the tests don't use a particular fixture, pytest is allowed to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jeffersfp sorry for the delay. The way that I personally deal with it is by rewriting my tests so I don’t need to use lazy-fixtures.
I’m planning a rewrite of this plugin to clean up the code a bit and make the options behavior more consistent, during this it might be possible that this problem is solved as a side-effect. However it is just a maybe as I don’t intend to explicitly support lazy-fixtures.
So, I’m closing this considering as a decision “by-design”.
Holy moly! I’m facing this issue… What did you guys do to handle this problem?