Making py.test, coverage and tox work together: __init__.py in tests folder?
Date : March 29 2020, 07:55 AM
wish helps you I'm having a weird problem with tox, py.test, coverage and pytest-cov: when py.test with the --cov option is launched from tox, it seems to require an __init__.py file in the tests folder which is not immediately obvious. , Use --cov {envsitepackagesdir}/ in tox.ini.
|
How can I ignore all tests in a specific folder using nose?
Date : March 29 2020, 07:55 AM
Hope that helps There is an --exclude-dir option introduced by nose-exclude: nosetests --exclude-dir="basic tests/"
|
Pytest: how to work around missing __init__.py in the tests folder?
Date : March 29 2020, 07:55 AM
seems to work fine I am storing all the pytest files in the tests sub-directory under the project root. There is no __init__.py in that directory or above and pytest tests/test_a.py works as expected. I can also run pytest test_a.py directly from within the tests folder. , Add __init__.py and use a relative or absolute import in conftest.py: # relative
from .config import HOST_URL_DEFAULT, USER, PASSWORD
# absolute
from tests.config import HOST_URL_DEFAULT, USER, PASSWORD
mysource/ # root directory for both mypackage and mytests
+- mypackage/ # should be src/mypackage instead!
+- __init__.py
+- abcd.py
+- mytests
+- __init__.py
+- tests_abcd.py # ``from mypackage import abcd`` imports from source
|
Django nose to run only project tests
Tag : django , By : user119605
Date : March 29 2020, 07:55 AM
|
Use nose.run() or nose.main() to run tests in a specific module
Date : March 29 2020, 07:55 AM
|