pytest: Collection warning emitted for modules which should not being collected
When setting the testpaths
key under the [pytest]
section in tox.ini
, pytest seems to ignore it.
See the comment thread in this PR for more information.
Result of `pip list`
appdirs 1.4.3
Appium-Python-Client 0.44
aspy.yaml 1.3.0
atomicwrites 1.3.0
attrs 19.1.0
black 19.3b0
certifi 2019.3.9
cfgv 2.0.0
chardet 3.0.4
Click 7.0
entrypoints 0.3
filelock 3.0.12
flake8 3.7.7
identify 1.4.3
idna 2.8
importlib-metadata 0.15
mccabe 0.6.1
more-itertools 7.0.0
nodeenv 1.3.3
pip 19.1.1
pluggy 0.12.0
pre-commit 1.16.1
py 1.8.0
pycodestyle 2.5.0
pyflakes 2.1.1
pytest 4.5.0
pytest-base-url 1.4.1
pytest-html 1.20.0
pytest-metadata 1.8.0
pytest-selenium 1.9.2.dev112+g77fed97.d20190529 /Users/jimbrannlund/dev/pytest-dev/pytest-selenium
pytest-variables 1.7.1
PyYAML 5.1
requests 2.22.0
selenium 3.141.0
setuptools 41.0.1
six 1.12.0
toml 0.10.0
tox 3.12.1
urllib3 1.25.3
virtualenv 16.6.0
wcwidth 0.1.7
wheel 0.33.4
zipp 0.5.1
python: 3.7.3 macOSX: 10.14.4
I see the same outcome if I run the same command as defined in tox.ini (pytest -n auto -v -r a
) w/o tox.
pytest header seems to pickup the value correctly at least:
rootdir: /Users/<user>/dev/pytest-dev/pytest-selenium, inifile: tox.ini, testpaths: testing
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (10 by maintainers)
Commits related to this issue
- Show test module in the PytestCollectionWarning message Related to #5330 — committed to nicoddemus/pytest by nicoddemus 5 years ago
- Merge #81 81: Update pytest to 4.6.1 r=rehandalal a=pyup-bot This PR updates [pytest](https://pypi.org/project/pytest) from **4.5.0** to **4.6.1**. <details> <summary>Changelog</summary> ... — committed to rehandalal/therapist by bors[bot] 5 years ago
- Merge #1896 1896: Scheduled weekly dependency update for week 22 r=rehandalal a=pyup-bot ### Update [botocore](https://pypi.org/project/botocore) from **1.12.156** to **1.12.159**. <details> ... — committed to mozilla/normandy by bors[bot] 5 years ago
- Merge #32 32: Pin pytest to latest version 5.1.3 r=duckinator a=pyup-bot This PR pins [pytest](https://pypi.org/project/pytest) to the latest release **5.1.3**. <details> <summary>Changelog</s... — committed to duckinator/bork by bors[bot] 5 years ago
- Merge #1 1: Initial Update r=aragilar a=pyup-bot This PR sets up pyup.io on this repo and updates all dependencies at once, in a single branch. Subsequent pull requests will update one dependency... — committed to aragilar/pytest-info-collector by bors[bot] 4 years ago
- Merge #1 1: Initial Update r=aragilar a=pyup-bot This PR sets up pyup.io on this repo and updates all dependencies at once, in a single branch. Subsequent pull requests will update one dependency... — committed to aragilar/spaceplot by bors[bot] 4 years ago
- Merge #1 1: Initial Update r=aragilar a=pyup-bot This PR sets up pyup.io on this repo and updates all dependencies at once, in a single branch. Subsequent pull requests will update one dependency... — committed to aragilar/venv_tools by bors[bot] 4 years ago
- Merge #5 5: Initial Update r=aragilar a=pyup-bot This PR sets up pyup.io on this repo and updates all dependencies at once, in a single branch. Subsequent pull requests will update one dependency... — committed to aragilar/root-solver by bors[bot] 4 years ago
@BeyondEvil that’s how it works today, pytest will call
dir()
on the imported module, and look into the objects returned for test classes/functions. It doesn’t do any special treatment to see if the objects were declared in that module or were imported. It is surprising in some cases, but is very useful in others: you can import tests from other modules which test other symbols in the importing module.I opened #5346 to improve the message and make the problem more obvious in the first place. 👍
Updated the title. 😁
I managed to reproduce this without using
tox
.Thanks @BeyondEvil, I will try to take a look when I have some time. 👍