Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: fix testing *rst tutorials #133

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions scpdt/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ def pytest_ignore_collect(collection_path, config):
if "tests" in path_str or "test_" in path_str:
return True

for entry in config.dt_config.pytest_extra_skips:
if entry in str(collection_path):
return True


def pytest_collection_modifyitems(config, items):
"""
Expand Down Expand Up @@ -81,7 +85,7 @@ def pytest_collection_modifyitems(config, items):

parent_full_name = item.parent.module.__name__
is_public = "._" not in parent_full_name
is_duplicate = parent_full_name in extra_skips or item.name in extra_skips
is_duplicate = parent_full_name in extra_skips or item.name in extra_skips

if is_public and not is_duplicate:
unique_items.append(item)
Expand Down Expand Up @@ -160,7 +164,7 @@ def collect(self):
name = self.path.name
globs = {"__name__": "__main__"}

optionflags = pydoctest.get_optionflags(self)
optionflags = dt_config.optionflags

# Plug in the custom runner: `PytestDTRunner`
runner = _get_runner(self.config,
Expand Down Expand Up @@ -206,7 +210,6 @@ def run(self, test, compileflags=None, out=None, clear_globs=False):
"""
dt_config = config.dt_config


with np_errstate():
with dt_config.user_context_mgr(test):
with matplotlib_make_nongui():
Expand Down
Loading