This repository was archived by the owner on Apr 29, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 4
4
### Fixed
5
5
- Fix fixtures defined with ` @pytest.yield_fixture ` decorator still showing FP
6
6
- Fix crashes when using fixture + if + inline import
7
+ - Fix crashes when relatively importing fixtures (` from ..conftest import fixture ` )
7
8
8
9
## [ 0.1.1] - 2020-05-19
9
10
### Fixed
Original file line number Diff line number Diff line change @@ -64,12 +64,16 @@ def _can_use_fixture(function):
64
64
65
65
def _is_same_module (fixtures , import_node , fixture_name ):
66
66
'''Comparing pytest fixture node with astroid.ImportFrom'''
67
- for fixture in fixtures [fixture_name ]:
68
- for import_from in import_node .root ().globals [fixture_name ]:
69
- if inspect .getmodule (fixture .func ).__file__ == \
70
- import_from .parent .import_module (import_from .modname ).file :
71
- return True
72
-
67
+ try :
68
+ for fixture in fixtures [fixture_name ]:
69
+ for import_from in import_node .root ().globals [fixture_name ]:
70
+ if inspect .getmodule (fixture .func ).__file__ == \
71
+ import_from .parent .import_module (import_from .modname ,
72
+ False ,
73
+ import_from .level ).file :
74
+ return True
75
+ except : # pylint: disable=bare-except
76
+ pass
73
77
return False
74
78
75
79
You can’t perform that action at this time.
0 commit comments