mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-10 07:41:51 +08:00
Discard imports of modules as pytest fixtures
This commit is contained in:
@@ -186,9 +186,12 @@ class FixtureFilter(ParserTreeFilter):
|
|||||||
# resolve possible imports before checking for a fixture
|
# resolve possible imports before checking for a fixture
|
||||||
if name.parent.type == "import_from":
|
if name.parent.type == "import_from":
|
||||||
imported_names = goto_import(self.parent_context, name)
|
imported_names = goto_import(self.parent_context, name)
|
||||||
|
# discard imports of whole modules, that have no tree_name
|
||||||
|
imported_tree_names = (
|
||||||
|
iname.tree_name for iname in imported_names if iname.tree_name
|
||||||
|
)
|
||||||
if any(
|
if any(
|
||||||
self._is_fixture(imported_name.tree_name)
|
self._is_fixture(tree_name) for tree_name in imported_tree_names
|
||||||
for imported_name in imported_names
|
|
||||||
):
|
):
|
||||||
yield name
|
yield name
|
||||||
elif self._is_fixture(name):
|
elif self._is_fixture(name):
|
||||||
|
|||||||
Reference in New Issue
Block a user