Skip to content

Commit 39e50b6

Browse files
committed
Do not leak _wish_index_items out of the index building function.
1 parent 3345636 commit 39e50b6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pytest_nodev/plugin.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ def pytest_addoption(parser):
6565
group.addoption('--wish-fail', action='store_true', help="Show wish failures.")
6666

6767

68-
def wish_ensuresession(config):
68+
def make_wish_index(config):
6969
if hasattr(config, '_wish_index_items'):
70-
return
70+
return config._wish_index_items
7171

7272
if config.getoption('wish_from_all') and os.environ.get('PYTEST_NODEV_MODE') != 'FEARLESS':
7373
raise ValueError("Use of --wish-from-all may be very dangerous, see the docs.")
@@ -112,17 +112,17 @@ def wish_ensuresession(config):
112112
# delegate interrupting hanging tests to pytest-timeout
113113
os.environ['PYTEST_TIMEOUT'] = os.environ.get('PYTEST_TIMEOUT', '1')
114114

115+
return config._wish_index_items
116+
115117

116118
def pytest_generate_tests(metafunc):
117119
if 'wish' not in metafunc.fixturenames:
118120
return
119121

120-
config = metafunc.config
121-
wish_ensuresession(config)
122-
123-
ids, params = config._wish_index_items
122+
ids, params = make_wish_index(metafunc.config)
124123
metafunc.parametrize('wish', params, ids=ids, scope='module')
125-
if not config.getoption('wish_fail'):
124+
125+
if not metafunc.config.getoption('wish_fail'):
126126
metafunc.function = pytest.mark.xfail(metafunc.function)
127127

128128

0 commit comments

Comments
 (0)