Skip to content

Commit 6d3aaa0

Browse files
committed
MAINT: plumb pytest_extra_skips through to DTConfig
1 parent de5e3f1 commit 6d3aaa0

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

.github/workflows/pip.yml

+8-7
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ jobs:
5252
run: |
5353
python -m scpdt scpdt/tests/finder_cases.py -vv
5454
55+
- name: Test pytest plugin
56+
# This test will fail in a venv where scpdt has not been installed and the plugin has not been activated
57+
run: |
58+
test_files=("scpdt/tests/module_cases.py" "scpdt/tests/stopwords_cases.py" "scpdt/tests/local_file_cases.py")
59+
for file in "${test_files[@]}"; do
60+
python -m pytest "${file}" --doctest-modules
61+
done
62+
5563
- name: Test testfile CLI
5664
run: |
5765
python -m scpdt ./scpdt/tests/scipy_linalg_tutorial_clone.rst -v
@@ -65,10 +73,3 @@ jobs:
6573
python -mpip install pooch
6674
python -c'from scipy import ndimage; from scpdt import testmod; testmod(ndimage, verbose=True, strategy="api")'
6775
68-
- name: Test pytest plugin
69-
# This test will fail in a venv where scpdt has not been installed and the plugin has not been activated
70-
run: |
71-
test_files=("scpdt/tests/module_cases.py" "scpdt/tests/stopwords_cases.py" "scpdt/tests/local_file_cases.py")
72-
for file in "${test_files[@]}"; do
73-
python -m pytest "${file}" --doctest-modules
74-
done

scpdt/impl.py

+9
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ class DTConfig:
6868
NameErrors. Set to True if you want to see these, or if your test
6969
is actually expected to raise NameErrors.
7070
Default is False.
71+
pytest_extra_skips : list
72+
A list of names/modules to skip when run under pytest plugin. Ignored
73+
otherwise.
7174
7275
"""
7376
def __init__(self, *, # DTChecker configuration
@@ -88,6 +91,7 @@ def __init__(self, *, # DTChecker configuration
8891
# Obscure switches
8992
parse_namedtuples=True, # Checker
9093
nameerror_after_exception=False, # Runner
94+
pytest_extra_skips=None, # plugin/collection
9195
):
9296
### DTChecker configuration ###
9397
# The namespace to run examples in
@@ -171,6 +175,11 @@ def __init__(self, *, # DTChecker configuration
171175
self.parse_namedtuples = parse_namedtuples
172176
self.nameerror_after_exception = nameerror_after_exception
173177

178+
#### pytest plugin additional switches
179+
if pytest_extra_skips is None:
180+
pytest_extra_skips = []
181+
self.pytest_extra_skips = pytest_extra_skips
182+
174183

175184
def try_convert_namedtuple(got):
176185
# suppose that "got" is smth like MoodResult(statistic=10, pvalue=0.1).

0 commit comments

Comments
 (0)