pytest_collection_modifyitems in subdir conftest recieves all tests
See original GitHub issueGiven the following test setup:
tests
| - a
| - __init__.py
| - conftest.py
| - test_foo.py
| - __init__.py
| - test_bar.py
# a/conftest.py
def pytest_collection_modifyitems(items):
for item in items:
print(item.name)
# a/test_foo.py
def test_foo():
pass
# test_bar.py
def test_bar():
pass
Based on the docs, I wouldn’t expect to see “test_bar” be printed, but I do.
Debug:
Package Version
------------------ -------
atomicwrites 1.4.0
attrs 19.3.0
colorama 0.4.3
importlib-metadata 1.6.0
more-itertools 8.2.0
packaging 20.3
pip 10.0.1
pluggy 0.13.1
py 1.8.1
pyparsing 2.4.7
pytest 5.4.2
setuptools 39.0.1
six 1.14.0
wcwidth 0.1.9
zipp 3.1.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Pytest marks: mark entire directory / package - Stack Overflow
The way I am currently doing this is for each test module, I add a pytest marker and then specify the marker from...
Read more >Writing plugins — pytest documentation
Writing plugins¶. It is easy to implement local conftest plugins for your own project or pip-installable plugins that can be used throughout many...
Read more >pytest Documentation - Read the Docs
pytest discovers all tests following its Conventions for Python ... the test module and get the custom output defined in the conftest file:....
Read more >Writing plugins — pytest documentation
by loading all conftest.py files as inferred by the command line invocation: ... is called for tests in the a sub directory but...
Read more >Testing with files and directories - Testfixtures - Read the Docs
These have an array of methods that let you perform common file and directory related tasks without all the manual boiler plate. The...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@The-Compiler @nimeshvashistha My bad 😅 September has been a very busy month.
Put me on the PR when it’s ready. I haven’t had much runtime with the Python documentation ecosystem and would love a reason to get familiar 😄
alright, thanks!