Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
13 changes: 11 additions & 2 deletions pytest_doctestplus/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ def check_required_modules(cls, mods):
if mod in cls._import_cache:
if not cls._import_cache[mod]:
return False
continue

if cls._module_checker.check(mod):
cls._import_cache[mod] = True
Expand Down Expand Up @@ -714,9 +715,17 @@ def test_filter(test):
for pats, mods in reqs.items():
if not isinstance(pats, tuple):
pats = (pats,)

for pat in pats:
if not fnmatch.fnmatch(test.name, '.'.join((name, pat))):
continue
if pat == '*':
pass
elif pat == '.' and test.name == name:
pass
elif fnmatch.fnmatch(test.name, '.'.join((name, pat))):
pass
else:
continue # The pattern does not apply

if not self.check_required_modules(mods):
return False
return True
Expand Down
8 changes: 8 additions & 0 deletions tests/python/doctests.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst

"""
Also module level skips should be matched with `*` and `.`, test at least
the `.` version (the star would match all others too).

>>> import foobar
"""

__doctest_skip__ = [
'skip_this_test',
'ClassWithSomeBadDocTests.this_test_fails',
'ClassWithAllBadDocTests.*',
]

__doctest_requires__ = {
'.': ['foobar'],
'depends_on_foobar': ['foobar'],
'depends_on_foobar_submodule': ['foobar.baz'],
'depends_on_two_modules': ['os', 'foobar'],
Expand Down