{"id":6439,"library":"pytest-filter-subpackage","title":"pytest-filter-subpackage","description":"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.","status":"active","version":"0.2.0","language":"en","source_language":"en","source_url":"https://github.com/astropy/pytest-filter-subpackage","tags":["pytest","plugin","testing","filtering","subpackage","astropy"],"install":[{"cmd":"pip install pytest-filter-subpackage","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Core testing framework that this plugin extends.","package":"pytest","optional":false},{"reason":"Became an explicit runtime dependency in v0.2.0 to resolve an implicit dependency.","package":"packaging","optional":false}],"imports":[{"note":"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.","symbol":"pytest-filter-subpackage","correct":"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":{"code":"pytest -P wcs,io.fits","lang":"bash","description":"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."},"warnings":[{"fix":"Upgrade `pytest-filter-subpackage` to `0.2.0` or a newer version using `pip install --upgrade pytest-filter-subpackage`.","message":"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.","severity":"breaking","affected_versions":"<0.2.0 with pytest>=8.0"},{"fix":"Always provide only the sub-package name(s) relative to the top-level package, e.g., `pytest -P subpackage_name,another_subpackage`.","message":"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`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure `packaging` is installed: `pip install packaging`.","message":"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.","severity":"gotcha","affected_versions":"All versions since 0.2.0"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z"}