pytest-filter-subpackage
pytest-filter-subpackage is a simple plugin for the pytest framework, currently at version 0.2.0. It provides a convenient command-line option for filtering tests based on sub-package names, enabling users to efficiently run tests for specific parts of their codebase. The project is actively maintained, with recent releases focusing on compatibility with newer pytest versions and dependency management.
Warnings
- breaking Compatibility with Pytest 8.x: Version 0.2.0 of `pytest-filter-subpackage` introduces compatibility with `pytest` version 8 and newer. If you are using `pytest` 8.x or upgrading to it, you must also upgrade `pytest-filter-subpackage` to version 0.2.0 or later to ensure proper functionality.
- gotcha Sub-package naming convention: The `-P` option expects sub-package names *without* the top-level package name. For instance, if your package structure is `my_app/subpackage1/test_foo.py`, you should use `pytest -P subpackage1`, not `pytest -P my_app.subpackage1`.
- gotcha Explicit `packaging` dependency: As of version 0.2.0, `packaging` is an explicit runtime dependency. While it might have been implicitly present in many environments before, ensure it's installed to avoid `ModuleNotFoundError` if you upgrade `pytest-filter-subpackage` and `packaging` was not otherwise explicitly installed in your environment.
Install
-
pip install pytest-filter-subpackage
Imports
- pytest-filter-subpackage
This is a pytest plugin and is automatically registered upon installation. It does not require explicit Python `import` statements in user code for its primary functionality.
Quickstart
pytest -P wcs,io.fits