Skip to content

Commit 2f00a0d

Browse files
committed
Python: Also test pytest fixture factories
1 parent 7872918 commit 2f00a0d

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

python/ql/test/query-tests/Imports/unused/UnusedImport.expected

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
| imports_test.py:10:1:10:22 | Import | Import of 'top_level_cycle' is not used. |
66
| imports_test.py:27:1:27:25 | Import | Import of 'func2' is not used. |
77
| imports_test.py:34:1:34:14 | Import | Import of 'module2' is not used. |
8-
| imports_test.py:116:1:116:67 | Import | Import of 'not_a_fixture' is not used. |
8+
| imports_test.py:116:1:116:85 | Import | Import of 'fixture_instance' is not used. |
9+
| imports_test.py:116:1:116:85 | Import | Import of 'not_a_fixture' is not used. |

python/ql/test/query-tests/Imports/unused/imports_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,4 @@ def baz() -> Optional['subexpression_return_type']:
113113
pass
114114

115115

116-
from pytest_fixtures import fixture, wrapped_fixture, not_a_fixture
116+
from pytest_fixtures import fixture, wrapped_fixture, fixture_instance, not_a_fixture

python/ql/test/query-tests/Imports/unused/pytest_fixtures.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,11 @@ def delegate():
1515
def wrapped_fixture():
1616
pass
1717

18+
@pytest.fixture(scope='session', autorun=True)
19+
def factory_fixture():
20+
pass
21+
22+
fixture_instance = factory_fixture()
23+
1824
def not_a_fixture():
1925
pass

0 commit comments

Comments
 (0)