pytest-dev / pytest-dev/pytest
doctest plugin runs when unwanted
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
This file fails when run explicitly with pytest:
$ pytest --doctest-glob *.nope README.rst
...
platform darwin -- Python 3.7.1, pytest-4.3.1, py-1.8.0, pluggy-0.9.0
...
...______ [doctest] README.rst __
093 'banner': Required(str),
...
102 >>> print(open('/etc/my_app/config.yaml').read())
UNEXPECTED EXCEPTION: FileNotFoundError(2, 'No such file or directory')
Things work fine if I just pytest in the root directory. The problem is that the doctest plugin is kicking in when it has not been requested, and indeed even when I try and explicitly stop it from working on this file. I use sybil for testing examples in my documentation as it provides for more flexibility.
Here's my full environment:
$ pip freeze
alabaster==0.7.12
atomicwrites==1.3.0
attrs==19.1.0
Babel==2.6.0
bleach==3.1.0
certifi==2019.3.9
chardet==3.0.4
-e git+git@github.com:Simplistix/configurator.git@1090b4db182490e523ca9b7415fd87ba784e25ae#egg=configurator
coverage==4.5.3
docutils==0.14
idna==2.8
imagesize==1.1.0
Jinja2==2.10
MarkupSafe==1.1.1
mock==2.0.0
more-itertools==6.0.0
packaging==19.0
pbr==5.1.3
pkginfo==1.5.0.1
pluggy==0.9.0
py==1.8.0
pyfakefs==3.5.8
Pygments==2.3.1
pyparsing==2.3.1
pytest==4.3.1
pytest-cov==2.6.1
pytz==2018.9
PyYAML==5.1
readme-renderer==24.0
requests==2.21.0
requests-toolbelt==0.9.1
setuptools-git==1.2
six==1.12.0
snowballstemmer==1.2.1
Sphinx==1.8.5
sphinxcontrib-websupport==1.1.0
sybil==1.0.9
testfixtures==6.6.1
toml==0.10.0
tqdm==4.31.1
twine==1.13.0
urllib3==1.24.1
voluptuous==0.11.5
webencodings==0.5.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with pytest --doctest-glob *.nope README.rst and compare it with running pytest in the repository root. Start by tracing how pytest selects the doctest plugin and handles the explicit README.rst argument. Done means the plugin does not run when it was not requested, including when the file is excluded by the doctest glob.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100