stefankoegl / python-json-patch

Applying JSON Patches in Python
https://python-json-patch.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
434 stars 94 forks source link

1.33: pytest by default is not able to find any units #150

Open kloczek opened 11 months ago

kloczek commented 11 months ago
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-json-patch-1.33-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-json-patch-1.33-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.17, pytest-7.4.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/python-json-patch-1.33
collected 0 items

=================================================================================== no tests ran in 0.01s ===================================================================================

However ..

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-json-patch-1.33-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-json-patch-1.33-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network' tests.py
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.17, pytest-7.4.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/python-json-patch-1.33
collected 110 items

tests.py ..............................................................................................................                                                               [100%]

==================================================================================== 110 passed in 0.17s ====================================================================================
stefankoegl commented 11 months ago

Can you elaborate?

kloczek commented 11 months ago

If by default pytest is not able to find units usually it means that names of the files to scan are not correct because pytest by default scans tests_*.py files.

stefankoegl commented 10 months ago

It does not seem to be based on the filename.

$ mv tests.py tests_main.py
$ pytest -ra -m 'not network'
============================== test session starts ==============================
platform darwin -- Python 3.10.4, pytest-7.4.0, pluggy-1.2.0
rootdir: /Users/skoegl/python-json-patch
collected 0 items                                                               

============================= no tests ran in 0.00s =============================

Any other ideas?

kloczek commented 10 months ago

https://docs.pytest.org/en/7.1.x/example/pythoncollection.html#changing-naming-conventions