Skip to content

Commit

Permalink
Merge pull request #201 from pllim/fix-ignore-collect
Browse files Browse the repository at this point in the history
MNT: Do not completely take over test collection ignore
  • Loading branch information
bsipocz authored Jun 7, 2023
2 parents e1eea63 + 8f25181 commit 02649fd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
0.12.2 (unreleased)
===================

- Compatibility with pytest 7.4 with respect to ``norecursedirs`` handling. [#201]

- Respect ``--doctest-continue-on-failure`` flag. [#197]

- Report doctests raising skip exceptions as skipped. [#196]
Expand Down
2 changes: 1 addition & 1 deletion pytest_doctestplus/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def get_list_opt(name):
self._ignore_paths.append(path)
break

return False
# None = Let other plugins decide the outcome.

def pytest_collect_file(self, path, parent):
"""Implements an enhanced version of the doctest module from py.test
Expand Down
23 changes: 23 additions & 0 deletions tests/test_doctestplus.py
Original file line number Diff line number Diff line change
Expand Up @@ -1142,3 +1142,26 @@ def foo():

result = testdir.inline_run(build_dir, '--doctest-plus', '--doctest-modules', '--doctest-ufunc')
result.assertoutcome(passed=2, failed=0)


def test_norecursedirs(testdir):
testdir.makeini(
"""
[pytest]
norecursedirs = \"bad_dir\"
doctestplus = enabled
"""
)
subdir = testdir.mkdir("bad_dir")
badfile = subdir.join("test_foobar.py")
badfile.write_text("""
def f():
'''
>>> x = 1/3.
>>> x
0.333333
'''
fail
""", "utf-8")
reprec = testdir.inline_run(str(testdir), "--doctest-plus")
reprec.assertoutcome(failed=0, passed=0)

0 comments on commit 02649fd

Please sign in to comment.