Skip to content

Commit ccec95d

Browse files
authored
BUG: fix testing *rst tutorials (#133)
- get optionflags from DTConfig - allow pytest_extra_skips in collection
1 parent 9d7bc5b commit ccec95d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

scpdt/plugin.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ def pytest_ignore_collect(collection_path, config):
5454
if "tests" in path_str or "test_" in path_str:
5555
return True
5656

57+
for entry in config.dt_config.pytest_extra_skips:
58+
if entry in str(collection_path):
59+
return True
60+
5761

5862
def pytest_collection_modifyitems(config, items):
5963
"""
@@ -101,7 +105,7 @@ def pytest_collection_modifyitems(config, items):
101105
# is not guaranteed)
102106
parent_full_name = item.parent.module.__name__
103107
is_public = "._" not in parent_full_name
104-
is_duplicate = parent_full_name in extra_skips or item.name in extra_skips
108+
is_duplicate = parent_full_name in extra_skips or item.name in extra_skips
105109

106110
if is_public and not is_duplicate:
107111
unique_items.append(item)
@@ -185,7 +189,7 @@ def collect(self):
185189
name = self.path.name
186190
globs = {"__name__": "__main__"}
187191

188-
optionflags = pydoctest.get_optionflags(self)
192+
optionflags = dt_config.optionflags
189193

190194
# Plug in the custom runner: `PytestDTRunner`
191195
runner = _get_runner(self.config,
@@ -231,7 +235,6 @@ def run(self, test, compileflags=None, out=None, clear_globs=False):
231235
"""
232236
dt_config = config.dt_config
233237

234-
235238
with np_errstate():
236239
with dt_config.user_context_mgr(test):
237240
with matplotlib_make_nongui():

0 commit comments

Comments
 (0)