connexion
connexion copied to clipboard
Run separate test suites for optional requirements
The tests are currently run using an environment in which all packages are installed, including optional ones such as aiohttp. This could lead to some tests passing while they shouldn't. For example, see #1377 .
We should run the tests that don't require any optional dependencies in an environment in which they are not installed, and tests that do require optional dependencies, should be run separately.
Some ways of achieving this:
pytest.skipandpytest.skipif: https://docs.pytest.org/en/stable/skipping.html#skipif- can also skip entire test modules, so can skip if the optional dependency import fails
pytest.mark: https://docs.pytest.org/en/6.2.x/example/markers.html- this will still require managing the
ImportErrors during test collection
- this will still require managing the
I originally proposed pytest.mark instead of pytest.skip since skipping tests is silent. If we don't install the optional dependencies correctly in the test environment, the tests will just be skipped instead of failing.
You can mark complete modules as well, don't know if that solves the ImortError issue?
Final option is to ignore specific paths via command line arguments. This is probably the easiest approach if we only need to ignore the aiohttp directory, but is not really suited for more complex setups.