Open debonte opened 1 year ago
test_fixtures.py
from pytest import fixture @fixture def fixture_one(): return 1 @fixture def fixture_two(): return 2
test_repro.py
from test_fixtures import fixture_one def test_foo(fixture_two): pass
fixture_two
Type of fixture_two is unknown since it is not imported. If you comment out the import of fixture_one you get the expected behavior:
fixture_one
Hover shows def fixture_two() -> Literal[2]
def fixture_two() -> Literal[2]
I can repro this but this may be because fixture_two is allowed from pytest's point of view. Double checking.
No the test fails with the expected error. You have to actually import the fixture for the test to pass.
Code Snippet
test_fixtures.py
test_repro.py
Repro Steps
fixture_two
usage intest_repro.py
Expected behavior
Type of
fixture_two
is unknown since it is not imported. If you comment out the import offixture_one
you get the expected behavior:Actual behavior
Hover shows
def fixture_two() -> Literal[2]