Registry / testing / pytest-filter-subpackage

pytest-filter-subpackage

JSON →
library0.2.0pypypiunverified

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.

pip install pytest-filter-subpackage
INSTALL
IMPORT
SIG · PYTEST-FILTER-SUBP
P
pytest-filter-subpackage
testingpythonv0.2.0
Install
2.7s avg
Import
Disk
29MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 30.8MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.7s · import 0.000s · 31MB
29MB installed
● package 29MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

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.
Pytest plugins extend pytest's behavior directly; their functionality is typically exposed via command-line options or fixtures, not direct module imports into test files.

After installation, use the `-P` command-line option followed by a comma-separated list of sub-package names (without the top-level package name). For example, to run tests for `my_package.wcs` and `my_package.io.fits`, you would run `pytest -P wcs,io.fits` from your project root.

pytest -P wcs,io.fits
pytest --version
Debug
Known issues
breakingCompatibility 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.
fix
Upgrade `pytest-filter-subpackage` to `0.2.0` or a newer version using `pip install --upgrade pytest-filter-subpackage`.
affects: <0.2.0 with pytest>=8.0
gotchaSub-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`.
fix
Always provide only the sub-package name(s) relative to the top-level package, e.g., `pytest -P subpackage_name,another_subpackage`.
affects: All versions
gotchaExplicit `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.
fix
Ensure `packaging` is installed: `pip install packaging`.
affects: All versions since 0.2.0
Upgrade
Version history
0.2.0latest on PyPI · released Mar 4, 2024
Audit
Dependencies
pytestrequiredCore testing framework that this plugin extends.
packagingrequiredBecame an explicit runtime dependency in v0.2.0 to resolve an implicit dependency.
Agent activity
12 hits · last 30 days
node
10
Resources
pytest-filter-subpackage — pip install pytest-filter-subpackage · libregistry