mirror of
https://github.com/github/codeql.git
synced 2026-02-20 08:53:49 +01:00
Merge pull request #16762 from github/redsun82/python-disregard-unused-imports-in-pytest-tests
Python: failing unused import test case
This commit is contained in:
@@ -5,5 +5,6 @@
|
||||
| imports_test.py:10:1:10:22 | Import | Import of 'top_level_cycle' is not used. |
|
||||
| imports_test.py:27:1:27:25 | Import | Import of 'func2' is not used. |
|
||||
| imports_test.py:34:1:34:14 | Import | Import of 'module2' is not used. |
|
||||
| imports_test.py:116:1:116:85 | Import | Import of 'fixture_instance' is not used. |
|
||||
| imports_test.py:116:1:116:85 | Import | Import of 'not_a_fixture' is not used. |
|
||||
| imports_test.py:116:1:116:41 | Import | Import of 'not_a_fixture' is not used. |
|
||||
| imports_test.py:118:1:118:68 | Import | Import of 'session_fixture' is not used. |
|
||||
| imports_test.py:118:1:118:68 | Import | Import of 'wrapped_autouse_fixture' is not used. |
|
||||
|
||||
@@ -113,4 +113,6 @@ def baz() -> Optional['subexpression_return_type']:
|
||||
pass
|
||||
|
||||
|
||||
from pytest_fixtures import fixture, wrapped_fixture, fixture_instance, not_a_fixture
|
||||
from pytest_fixtures import not_a_fixture # BAD
|
||||
from pytest_fixtures import fixture, wrapped_fixture # GOOD (pytest fixtures are used implicitly by pytest)
|
||||
from pytest_fixtures import session_fixture, wrapped_autouse_fixture # GOOD [FALSE POSITIVE]
|
||||
|
||||
@@ -15,11 +15,20 @@ def fixture_wrapper():
|
||||
def wrapped_fixture():
|
||||
pass
|
||||
|
||||
@pytest.fixture(scope='session', autorun=True)
|
||||
def factory_fixture():
|
||||
pass
|
||||
|
||||
fixture_instance = factory_fixture()
|
||||
@pytest.fixture(scope='session')
|
||||
def session_fixture():
|
||||
pass
|
||||
|
||||
def not_a_fixture():
|
||||
pass
|
||||
|
||||
def another_fixture_wrapper():
|
||||
@pytest.fixture(autouse=True)
|
||||
def delegate():
|
||||
pass
|
||||
return delegate
|
||||
|
||||
@another_fixture_wrapper
|
||||
def wrapped_autouse_fixture():
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user