|
38 | 38 |
|
39 | 39 |
|
40 | 40 | def pytest_addoption(parser): |
41 | | - group = parser.getgroup('wish') |
| 41 | + group = parser.getgroup('nodev') |
42 | 42 | group.addoption( |
43 | 43 | '--wish-from-stdlib', action='store_true', |
44 | 44 | help="Collects objects form the Python standard library.") |
@@ -66,11 +66,11 @@ def pytest_addoption(parser): |
66 | 66 | group.addoption('--wish-fail', action='store_true', help="Show wish failures.") |
67 | 67 |
|
68 | 68 |
|
69 | | -def make_wish_index(config): |
| 69 | +def make_candidate_index(config): |
70 | 70 | if config.getoption('wish_from_all') and os.environ.get('PYTEST_NODEV_MODE') != 'FEARLESS': |
71 | 71 | raise ValueError("Use of --wish-from-all may be very dangerous, see the docs.") |
72 | 72 |
|
73 | | - if not hasattr(config, '_wish_index_items'): |
| 73 | + if not hasattr(config, '_candicate_index'): |
74 | 74 | # take over collect logging |
75 | 75 | collect.logger.propagate = False |
76 | 76 | collect.logger.setLevel(logging.DEBUG) # FIXME: loglevel should be configurable |
@@ -109,40 +109,40 @@ def make_wish_index(config): |
109 | 109 | ) |
110 | 110 |
|
111 | 111 | # store index |
112 | | - config._wish_index_items = list(zip(*sorted(object_index.items()))) or [(), ()] |
| 112 | + config._candicate_index = list(zip(*sorted(object_index.items()))) or [(), ()] |
113 | 113 |
|
114 | | - return config._wish_index_items |
| 114 | + return config._candicate_index |
115 | 115 |
|
116 | 116 |
|
117 | 117 | def pytest_pycollect_makeitem(collector, name, obj): |
118 | 118 | target_marker = getattr(obj, 'target', None) |
119 | 119 | if target_marker and getattr(target_marker, 'args', []): |
120 | 120 | target_name = target_marker.args[0] |
121 | 121 |
|
122 | | - def wrapper(wish, monkeypatch, *args, **kwargs): |
| 122 | + def wrapper(candidate, monkeypatch, *args, **kwargs): |
123 | 123 | if '.' in target_name: |
124 | | - monkeypatch.setattr(target_name, wish, raising=False) |
| 124 | + monkeypatch.setattr(target_name, candidate, raising=False) |
125 | 125 | else: |
126 | | - monkeypatch.setattr(inspect.getmodule(obj), target_name, wish, raising=False) |
| 126 | + monkeypatch.setattr(inspect.getmodule(obj), target_name, candidate, raising=False) |
127 | 127 | return obj(*args, **kwargs) |
128 | 128 |
|
129 | 129 | wrapper.__dict__ = obj.__dict__ |
130 | 130 | return list(collector._genfunctions(name, wrapper)) |
131 | 131 |
|
132 | 132 |
|
133 | 133 | def pytest_generate_tests(metafunc): |
134 | | - if 'wish' not in metafunc.fixturenames: |
| 134 | + if 'candidate' not in metafunc.fixturenames: |
135 | 135 | return |
136 | 136 |
|
137 | | - ids, params = make_wish_index(metafunc.config) |
138 | | - metafunc.parametrize('wish', params, ids=ids, scope='module') |
| 137 | + ids, params = make_candidate_index(metafunc.config) |
| 138 | + metafunc.parametrize('candidate', params, ids=ids, scope='module') |
139 | 139 |
|
140 | 140 | if not metafunc.config.getoption('wish_fail'): |
141 | 141 | metafunc.function = pytest.mark.xfail(metafunc.function) |
142 | 142 |
|
143 | 143 |
|
144 | 144 | def pytest_terminal_summary(terminalreporter): |
145 | | - if not hasattr(terminalreporter.config, '_wish_index_items'): |
| 145 | + if not hasattr(terminalreporter.config, '_candicate_index'): |
146 | 146 | return |
147 | 147 |
|
148 | 148 | hit_state = 'passed' if terminalreporter.config.getoption('wish_fail') else 'xpassed' |
|
0 commit comments