-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
status: criticalgrave problem or usability issue that affects lots of usersgrave problem or usability issue that affects lots of userstype: regressionindicates a problem that was introduced in a release which was working previouslyindicates a problem that was introduced in a release which was working previously
Description
Hi!
I've found an issue with pytest 3.7 while collecting tests on a mixed Python packages and modules folder structure, which worked correctly on previous versions of pytest. For instance if I setup a folder structure like this:
.
└── src
├── folder_1
│ └── test
│ └── test_1.py
└── folder_2
└── test
└── test_2.py
Each test_*.py
file containing a dummy test like:
def test_1():
assert True
pytest collects tests correctly:
$ py.test --collect-only
=========================================================================================== test session starts ============================================================================================
platform darwin -- Python 2.7.10, pytest-3.7.0, py-1.5.4, pluggy-0.7.1
rootdir: /Users/eduardo/tests, inifile:
collected 2 items
<Module 'src/folder_1/test/test_1.py'>
<Function 'test_1'>
<Module 'src/folder_2/test/test_2.py'>
<Function 'test_2'>
======================================================================================= no tests ran in 0.05 seconds =======================================================================================
However if I convert one of the folders to a Python package, only the tests inside that folder are being collected:
.
└── src
├── __init__.py
├── folder_1
│ ├── __init__.py
│ └── test
│ └── test_1.py
└── folder_2
└── test
└── test_2.py
$ py.test --collect-only
=========================================================================================== test session starts ============================================================================================
platform darwin -- Python 2.7.10, pytest-3.7.0, py-1.5.4, pluggy-0.7.1
rootdir: /Users/eduardo/tests, inifile:
collected 1 item
<Package '/Users/eduardo/tests/src'>
<Package '/Users/eduardo/tests/src/folder_1'>
<Module 'test_1.py'>
<Function 'test_1'>
======================================================================================= no tests ran in 0.03 seconds =======================================================================================
I'm not pretty sure if this is the intended behaviour or not.
Debugging info:
pip list
(fresh venv tested with python2.7 and 3.6 with same results)
$ pip list
Package Version
-------------- -------
atomicwrites 1.1.5
attrs 18.1.0
funcsigs 1.0.2
more-itertools 4.3.0
pathlib2 2.3.2
pip 18.0
pluggy 0.7.1
py 1.5.4
pytest 3.7.0
scandir 1.7
setuptools 40.0.0
six 1.11.0
wheel 0.31.1
armenak-baburyan and vshevchenk
Metadata
Metadata
Assignees
Labels
status: criticalgrave problem or usability issue that affects lots of usersgrave problem or usability issue that affects lots of userstype: regressionindicates a problem that was introduced in a release which was working previouslyindicates a problem that was introduced in a release which was working previously