Closed fkromer closed 5 years ago
GitMate.io thinks possibly related issues are https://github.com/pytest-dev/pytest/issues/821 (Running py.test without arguments raises missing argument error), https://github.com/pytest-dev/pytest/issues/3198 (Ignore individual tests), https://github.com/pytest-dev/pytest/issues/1484 (running py.test), https://github.com/pytest-dev/pytest/issues/2371 (Running tests inside namespace packages ?), and https://github.com/pytest-dev/pytest/issues/2544 (Run tests truly programmatically).
those need to be an actual pytest plugin in that case - early conftests are not discovered in packages
@RonnyPfannschmidt Thx for saving me time otherwise wasted for unsuccessful exploration :slightly_smiling_face:
I know about pytest-dev/cookiecutter-pytest-plugin which creates a structure like this (only files relevant for this issue shown):
pytest-awesome/
├── pytest_awesome.py
├── setup.py
├── tests
│ ├── conftest.py
│ └── test_awesome.py
└── tox.ini
If I consider the exemplary test only package structure (inclusive their utilities, ideally importable by other packages/pytest-plugins, etc.):
pytest-awesome/pytest_awesome.py
as well? What's best practice for their location?utils.py
and other_utils.py
into the cookiecutter skeleton? What's best practice for their location?test_utils.py
and other_utils.py
into the cookiecutter skeleton?In essence: Is there something preventing me from structuring the package like following for a "easy" and a "full-blown" case?
Easy case with separate fixtures and utils:
pytest-awesome/
├── pytest_awesome.py
├── setup.py
├── fixtures.py
├── test_fixtures.py
├── utils.py
├── test_utils.py
├── tests
│ ├── conftest.py
│ └── test_awesome.py
└── tox.ini
Full-blown case with separate fixtures and utils:
pytest-awesome/
├── pytest_awesome.py
├── setup.py
├── fixtures
│ ├── fixtures_a.py
│ └── fixtures_b.py
├── utils
│ ├── utils_a.py
│ └── utils_b.py
├── plugin_tests
├──── fixtures
│ ├── test_fixtures_a.py
│ └── test_fixtures_b.py
├──── utils
│ ├── test_utils_a.py
│ └── test_utils_b.py
├── tests
│ ├── conftest.py
│ └── test_awesome.py
└── tox.ini
Closing as inactive.
I created a test only package like described here (wheel, tests deployed via
data_package=
). I noticed that if the tests are run on Ubuntu withpytest --pyargs <package-name> <custom-arguments>
the tests are detected and run but they fail during setup because the custom command line arguments are not recognized fromconftest.py
. I found a workaround for this issue. Is this the recommended way to handle this my use case (deploy test only package with custom command line arguments)?