././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1709571128.2421494 pytest-filter-subpackage-0.2.0/0000755000175100001770000000000000000000000017235 5ustar00runnerdocker00000000000000././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1709571128.2381492 pytest-filter-subpackage-0.2.0/.github/0000755000175100001770000000000000000000000020575 5ustar00runnerdocker00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571117.0 pytest-filter-subpackage-0.2.0/.github/dependabot.yml0000644000175100001770000000111600000000000023424 0ustar00runnerdocker00000000000000# To get started with Dependabot version updates, you'll need to specify which # package ecosystems to update and where the package manifests are located. # Please see the documentation for all configuration options: # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates version: 2 updates: - package-ecosystem: "github-actions" # See documentation for possible values directory: ".github/workflows" # Location of package manifests schedule: interval: "weekly" groups: actions: patterns: - "*" ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1709571128.2381492 pytest-filter-subpackage-0.2.0/.github/workflows/0000755000175100001770000000000000000000000022632 5ustar00runnerdocker00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571117.0 pytest-filter-subpackage-0.2.0/.github/workflows/publish.yml0000644000175100001770000000234300000000000025025 0ustar00runnerdocker00000000000000name: Release on: pull_request: push: tags: - '*' jobs: build-n-publish: name: Build and publish Python 🐍 distributions 📦 to PyPI runs-on: ubuntu-latest if: ((github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) || contains(github.event.pull_request.labels.*.name, 'Build wheels')) steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/setup-python@v5 with: python-version: 3.8 - name: Install python-build and twine run: python -m pip install pip build "twine>=3.3" -U - name: Build package run: python -m build --sdist --wheel . - name: List result run: ls -l dist - name: Check long_description run: python -m twine check --strict dist/* - name: Test package run: | cd .. python -m venv testenv testenv/bin/pip install pytest pytest-doctestplus pytest-filter-subpackage/dist/*.whl testenv/bin/pytest pytest-filter-subpackage - name: Publish distribution 📦 to PyPI if: startsWith(github.ref, 'refs/tags') uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.pypi_password }} ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571117.0 pytest-filter-subpackage-0.2.0/.github/workflows/python-tests.yml0000644000175100001770000000513700000000000026044 0ustar00runnerdocker00000000000000name: Run unit tests on: pull_request: push: branches: [ main ] tags: - '*' workflow_dispatch: schedule: # Run every Thursday at 03:53 UTC - cron: 53 3 * * 4 jobs: tests: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - os: ubuntu-latest python-version: 3.8 toxenv: py38-test-pytestoldest - os: windows-latest python-version: 3.8 toxenv: py38-test-pytest50 - os: macos-latest python-version: 3.8 toxenv: py38-test-pytest51 - os: ubuntu-latest python-version: 3.8 toxenv: py38-test-pytest52 - os: windows-latest python-version: 3.8 toxenv: py38-test-pytest53 - os: ubuntu-latest python-version: 3.8 toxenv: py38-test-pytest60 - os: ubuntu-latest python-version: 3.9 toxenv: py39-test-pytest61 - os: ubuntu-latest python-version: 3.9 toxenv: py39-test-pytest62 - os: ubuntu-latest python-version: '3.10' toxenv: py310-test-pytest70 - os: ubuntu-latest python-version: '3.10' toxenv: py310-test-pytest71 - os: windows-latest python-version: '3.11' toxenv: py311-test-pytest72 - os: ubuntu-latest python-version: '3.11' toxenv: py311-test-pytest73 - os: ubuntu-latest python-version: '3.11' toxenv: py311-test-pytest74 - os: ubuntu-latest python-version: '3.12' toxenv: py312-test-pytest80 - os: macos-latest python-version: '3.12' toxenv: py312-test-pytest80 - os: windows-latest python-version: '3.12' toxenv: py312-test-pytest80 - os: macos-latest python-version: '3.11' toxenv: py311-test-pytestdev - os: windows-latest python-version: '3.11' toxenv: py311-test-pytestdev - os: ubuntu-latest python-version: '3.12' toxenv: py312-test-pytestdev steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install Tox run: python -m pip install tox - name: Run Tox run: tox ${{ matrix.toxargs }} -v -e ${{ matrix.toxenv }} ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571117.0 pytest-filter-subpackage-0.2.0/.gitignore0000644000175100001770000000117200000000000021226 0ustar00runnerdocker00000000000000# Compiled files *.py[cod] *.a *.o *.so *.pyd __pycache__ # Ignore .c files by default to avoid including generated code. If you want to # add a non-generated .c extension, use `git add -f filename.c`. *.c # Other generated files MANIFEST # Sphinx _build _generated docs/api docs/generated # Packages/installer info *.egg *.egg-info dist build eggs .eggs parts bin var sdist develop-eggs .installed.cfg distribute-*.tar.gz # Other .cache .tox .*.swp .*.swo *~ .project .pydevproject .settings .coverage cover htmlcov .pytest_cache # Env .venv venv .env # Mac OSX .DS_Store # PyCharm .idea pytest_filter_subpackage/version.py ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571117.0 pytest-filter-subpackage-0.2.0/CHANGES.rst0000644000175100001770000000073100000000000021040 0ustar00runnerdocker000000000000000.2.0 (2024-03-04) ================== - pytest 8.1 compatibility. [#15] - Dropped Python 3.7 support. Minimum supported pytest is now 4.6. [#15] 0.1.2 (2022-12-11) ================== - Fixed bug that caused ``-P time`` to also match ``package.timeseries``. [#7] - Dropped Python 3.6 support. 0.1.1 (2020-01-09) ================== - Fixed bug that caused e.g. ``-P sub`` to not match ``package.sub.other``. [#1] 0.1 (2020-01-09) ================ - Initial version. ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571117.0 pytest-filter-subpackage-0.2.0/LICENSE.rst0000644000175100001770000000272300000000000021055 0ustar00runnerdocker00000000000000Copyright (c) 2019, Astropy Developers All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Astropy Team nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571117.0 pytest-filter-subpackage-0.2.0/MANIFEST.in0000644000175100001770000000023200000000000020770 0ustar00runnerdocker00000000000000include LICENSE.rst include README.rst include CHANGES.rst include pyproject.toml include setup.cfg recursive-include tests * global-exclude *.pyc *.o ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1709571128.2421494 pytest-filter-subpackage-0.2.0/PKG-INFO0000644000175100001770000000531600000000000020337 0ustar00runnerdocker00000000000000Metadata-Version: 2.1 Name: pytest-filter-subpackage Version: 0.2.0 Summary: Pytest plugin for filtering based on sub-packages Home-page: https://github.com/astropy/pytest-filter-subpackage Author: The Astropy Developers Author-email: astropy.team@gmail.com License: BSD Keywords: pytest,py.test Classifier: Development Status :: 5 - Production/Stable Classifier: Framework :: Pytest Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 Classifier: Topic :: Software Development :: Testing Classifier: Topic :: Utilities Requires-Python: >=3.8 Description-Content-Type: text/x-rst License-File: LICENSE.rst Requires-Dist: pytest>=4.6 Requires-Dist: packaging Provides-Extra: test Requires-Dist: pytest; extra == "test" Requires-Dist: pytest-doctestplus; extra == "test" Requires-Dist: pytest-cov; extra == "test" ======================== pytest-filter-subpackage ======================== .. image:: https://dev.azure.com/astropy-project/pytest-filter-subpackage/_apis/build/status/astropy.pytest-filter-subpackage?branchName=main :target: https://dev.azure.com/astropy-project/pytest-filter-subpackage/_build/latest?definitionId=5&branchName=main This package contains a simple plugin for the `pytest`_ framework that provides a shortcut to testing all code and documentation for a given sub-package. .. _pytest: https://pytest.org/en/latest/ Installation ------------ The ``pytest-filter-subpackage`` plugin can be installed using ``pip``:: $ pip install pytest-filter-subpackage It is also possible to install the latest development version from the source repository:: $ git clone https://github.com/astropy/pytest-filter-subpackage $ cd pytest-filter-subpackage $ pip install . In either case, the plugin will automatically be registered for use with ``pytest``. Usage ----- This plugin provides a ``-P`` option which takes a comma-separated list of sub-package names (without the top-level package name):: pytest -P wcs,io.fits which is equivalent to:: pytest **/wcs **/io/fits When used in conjunction with `pytest-doctestplus `_ this will result in both the narrative documentation and code being tested for a given sub-package. License ------- This plugin is licensed under a 3-clause BSD style license - see the ``LICENSE.rst`` file. ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571117.0 pytest-filter-subpackage-0.2.0/README.rst0000644000175100001770000000275700000000000020737 0ustar00runnerdocker00000000000000======================== pytest-filter-subpackage ======================== .. image:: https://dev.azure.com/astropy-project/pytest-filter-subpackage/_apis/build/status/astropy.pytest-filter-subpackage?branchName=main :target: https://dev.azure.com/astropy-project/pytest-filter-subpackage/_build/latest?definitionId=5&branchName=main This package contains a simple plugin for the `pytest`_ framework that provides a shortcut to testing all code and documentation for a given sub-package. .. _pytest: https://pytest.org/en/latest/ Installation ------------ The ``pytest-filter-subpackage`` plugin can be installed using ``pip``:: $ pip install pytest-filter-subpackage It is also possible to install the latest development version from the source repository:: $ git clone https://github.com/astropy/pytest-filter-subpackage $ cd pytest-filter-subpackage $ pip install . In either case, the plugin will automatically be registered for use with ``pytest``. Usage ----- This plugin provides a ``-P`` option which takes a comma-separated list of sub-package names (without the top-level package name):: pytest -P wcs,io.fits which is equivalent to:: pytest **/wcs **/io/fits When used in conjunction with `pytest-doctestplus `_ this will result in both the narrative documentation and code being tested for a given sub-package. License ------- This plugin is licensed under a 3-clause BSD style license - see the ``LICENSE.rst`` file. ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571117.0 pytest-filter-subpackage-0.2.0/pyproject.toml0000644000175100001770000000020400000000000022145 0ustar00runnerdocker00000000000000[build-system] requires = ["setuptools", "setuptools_scm", "wheel"] build-backend = 'setuptools.build_meta' ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1709571128.2381492 pytest-filter-subpackage-0.2.0/pytest_filter_subpackage/0000755000175100001770000000000000000000000024317 5ustar00runnerdocker00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571117.0 pytest-filter-subpackage-0.2.0/pytest_filter_subpackage/__init__.py0000644000175100001770000000016500000000000026432 0ustar00runnerdocker00000000000000# Licensed under a 3-clause BSD style license - see LICENSE.rst from .version import version as __version__ # noqa ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571117.0 pytest-filter-subpackage-0.2.0/pytest_filter_subpackage/plugin.py0000644000175100001770000001104300000000000026166 0ustar00runnerdocker00000000000000# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This plugin provides support for specifying the -P option to test both code and docs for a specific sub-package. """ import os import pytest from packaging.version import Version _pytest_version = Version(pytest.__version__) PYTEST_GE_8_0 = any([_pytest_version.is_devrelease, _pytest_version.is_prerelease, _pytest_version >= Version('8.0')]) def pytest_addoption(parser): parser.addoption("--package", "-P", action="store", help="The name of a specific package to test, e.g. " "'io.fits' or 'utils'. Accepts comma separated " "string to specify multiple packages.") if PYTEST_GE_8_0: @pytest.hookimpl(tryfirst=True) def pytest_ignore_collect(collection_path, config): # NOTE: it is important that when we don't want to skip a file we return # None and not False - if we return False pytest will not call any other # pytest_ignore_collect function in other plugins, e.g. pytest-doctestplus. # If the --package/-P option wasn't specified, don't do anything if config.getvalue('package') is None: return None # If the path is a directory, never skip - just do the filtering on a file # by file basis. if collection_path.is_dir(): return None # Otherwise ignore filename for remainder of checks path = str(collection_path.parent) # Split path into components path = path.split(os.path.sep) # Now cycle through and find the top level of the package - this is the # last one that contains an ``__init__.py`` or ``index.rst`` file. We need # to make sure that at least one of these files was found before escaping. found_prev = False for i in range(len(path), -1, -1): subpath = os.path.sep.join(path[:i]) found = (os.path.exists(os.path.join(subpath, '__init__.py')) or os.path.exists(os.path.join(subpath, 'index.rst'))) if found_prev and not found: break found_prev = found subpackage_path = path[i+1:] # Find selected sub-packages selected = config.getvalue('package').strip().split(',') # Finally, we check if this is one of the specified ones for subpackage_target in selected: for i, target in enumerate(subpackage_target.split('.')): if i >= len(subpackage_path) or target != subpackage_path[i]: break else: return None return True else: @pytest.hookimpl(tryfirst=True) def pytest_ignore_collect(path, config): # NOTE: it is important that when we don't want to skip a file we return # None and not False - if we return False pytest will not call any other # pytest_ignore_collect function in other plugins, e.g. pytest-doctestplus. # If the --package/-P option wasn't specified, don't do anything if config.getvalue('package') is None: return None # If the path is a directory, never skip - just do the filtering on a file # by file basis. if os.path.isdir(path): return None # Otherwise ignore filename for remainder of checks path = os.path.dirname(path) # Split path into components path = path.split(os.path.sep) # Now cycle through and find the top level of the package - this is the # last one that contains an ``__init__.py`` or ``index.rst`` file. We need # to make sure that at least one of these files was found before escaping. found_prev = False for i in range(len(path), -1, -1): subpath = os.path.sep.join(path[:i]) found = (os.path.exists(os.path.join(subpath, '__init__.py')) or os.path.exists(os.path.join(subpath, 'index.rst'))) if found_prev and not found: break found_prev = found subpackage_path = path[i+1:] # Find selected sub-packages selected = config.getvalue('package').strip().split(',') # Finally, we check if this is one of the specified ones for subpackage_target in selected: for i, target in enumerate(subpackage_target.split('.')): if i >= len(subpackage_path) or target != subpackage_path[i]: break else: return None return True ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571128.0 pytest-filter-subpackage-0.2.0/pytest_filter_subpackage/version.py0000644000175100001770000000063300000000000026360 0ustar00runnerdocker00000000000000# file generated by setuptools_scm # don't change, don't track in version control TYPE_CHECKING = False if TYPE_CHECKING: from typing import Tuple, Union VERSION_TUPLE = Tuple[Union[int, str], ...] else: VERSION_TUPLE = object version: str __version__: str __version_tuple__: VERSION_TUPLE version_tuple: VERSION_TUPLE __version__ = version = '0.2.0' __version_tuple__ = version_tuple = (0, 2, 0) ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1709571128.2421494 pytest-filter-subpackage-0.2.0/pytest_filter_subpackage.egg-info/0000755000175100001770000000000000000000000026011 5ustar00runnerdocker00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571128.0 pytest-filter-subpackage-0.2.0/pytest_filter_subpackage.egg-info/PKG-INFO0000644000175100001770000000531600000000000027113 0ustar00runnerdocker00000000000000Metadata-Version: 2.1 Name: pytest-filter-subpackage Version: 0.2.0 Summary: Pytest plugin for filtering based on sub-packages Home-page: https://github.com/astropy/pytest-filter-subpackage Author: The Astropy Developers Author-email: astropy.team@gmail.com License: BSD Keywords: pytest,py.test Classifier: Development Status :: 5 - Production/Stable Classifier: Framework :: Pytest Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 Classifier: Topic :: Software Development :: Testing Classifier: Topic :: Utilities Requires-Python: >=3.8 Description-Content-Type: text/x-rst License-File: LICENSE.rst Requires-Dist: pytest>=4.6 Requires-Dist: packaging Provides-Extra: test Requires-Dist: pytest; extra == "test" Requires-Dist: pytest-doctestplus; extra == "test" Requires-Dist: pytest-cov; extra == "test" ======================== pytest-filter-subpackage ======================== .. image:: https://dev.azure.com/astropy-project/pytest-filter-subpackage/_apis/build/status/astropy.pytest-filter-subpackage?branchName=main :target: https://dev.azure.com/astropy-project/pytest-filter-subpackage/_build/latest?definitionId=5&branchName=main This package contains a simple plugin for the `pytest`_ framework that provides a shortcut to testing all code and documentation for a given sub-package. .. _pytest: https://pytest.org/en/latest/ Installation ------------ The ``pytest-filter-subpackage`` plugin can be installed using ``pip``:: $ pip install pytest-filter-subpackage It is also possible to install the latest development version from the source repository:: $ git clone https://github.com/astropy/pytest-filter-subpackage $ cd pytest-filter-subpackage $ pip install . In either case, the plugin will automatically be registered for use with ``pytest``. Usage ----- This plugin provides a ``-P`` option which takes a comma-separated list of sub-package names (without the top-level package name):: pytest -P wcs,io.fits which is equivalent to:: pytest **/wcs **/io/fits When used in conjunction with `pytest-doctestplus `_ this will result in both the narrative documentation and code being tested for a given sub-package. License ------- This plugin is licensed under a 3-clause BSD style license - see the ``LICENSE.rst`` file. ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571128.0 pytest-filter-subpackage-0.2.0/pytest_filter_subpackage.egg-info/SOURCES.txt0000644000175100001770000000125200000000000027675 0ustar00runnerdocker00000000000000.gitignore CHANGES.rst LICENSE.rst MANIFEST.in README.rst pyproject.toml setup.cfg setup.py tox.ini .github/dependabot.yml .github/workflows/publish.yml .github/workflows/python-tests.yml pytest_filter_subpackage/__init__.py pytest_filter_subpackage/plugin.py pytest_filter_subpackage/version.py pytest_filter_subpackage.egg-info/PKG-INFO pytest_filter_subpackage.egg-info/SOURCES.txt pytest_filter_subpackage.egg-info/dependency_links.txt pytest_filter_subpackage.egg-info/entry_points.txt pytest_filter_subpackage.egg-info/not-zip-safe pytest_filter_subpackage.egg-info/requires.txt pytest_filter_subpackage.egg-info/top_level.txt tests/conftest.py tests/test_filter_subpackage.py././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571128.0 pytest-filter-subpackage-0.2.0/pytest_filter_subpackage.egg-info/dependency_links.txt0000644000175100001770000000000100000000000032057 0ustar00runnerdocker00000000000000 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571128.0 pytest-filter-subpackage-0.2.0/pytest_filter_subpackage.egg-info/entry_points.txt0000644000175100001770000000010600000000000031304 0ustar00runnerdocker00000000000000[pytest11] pytest_filter_subpackage = pytest_filter_subpackage.plugin ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571128.0 pytest-filter-subpackage-0.2.0/pytest_filter_subpackage.egg-info/not-zip-safe0000644000175100001770000000000100000000000030237 0ustar00runnerdocker00000000000000 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571128.0 pytest-filter-subpackage-0.2.0/pytest_filter_subpackage.egg-info/requires.txt0000644000175100001770000000010300000000000030403 0ustar00runnerdocker00000000000000pytest>=4.6 packaging [test] pytest pytest-doctestplus pytest-cov ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571128.0 pytest-filter-subpackage-0.2.0/pytest_filter_subpackage.egg-info/top_level.txt0000644000175100001770000000003100000000000030535 0ustar00runnerdocker00000000000000pytest_filter_subpackage ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1709571128.2421494 pytest-filter-subpackage-0.2.0/setup.cfg0000644000175100001770000000266500000000000021067 0ustar00runnerdocker00000000000000[metadata] name = pytest-filter-subpackage url = https://github.com/astropy/pytest-filter-subpackage author = The Astropy Developers author_email = astropy.team@gmail.com classifiers = Development Status :: 5 - Production/Stable Framework :: Pytest Intended Audience :: Developers License :: OSI Approved :: BSD License Operating System :: OS Independent Programming Language :: Python Programming Language :: Python :: 3 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 Programming Language :: Python :: 3.12 Topic :: Software Development :: Testing Topic :: Utilities license = BSD description = Pytest plugin for filtering based on sub-packages long_description = file: README.rst long_description_content_type = text/x-rst keywords = pytest, py.test [options] zip_safe = False packages = find: python_requires = >=3.8 install_requires = pytest>=4.6 packaging [options.entry_points] pytest11 = pytest_filter_subpackage = pytest_filter_subpackage.plugin [options.extras_require] test = pytest pytest-doctestplus pytest-cov [tool:pytest] minversion = 4.6 testpaths = tests pytest_filter_subpackage xfail_strict = true filterwarnings = error ignore:file format.*:UserWarning ignore:.*non-empty pattern match.*:FutureWarning [flake8] max-line-length = 100 [bdist_wheel] universal = 1 [egg_info] tag_build = tag_date = 0 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571117.0 pytest-filter-subpackage-0.2.0/setup.py0000755000175100001770000000023200000000000020747 0ustar00runnerdocker00000000000000#!/usr/bin/env python import os from setuptools import setup setup(use_scm_version={'write_to': os.path.join('pytest_filter_subpackage', 'version.py')}) ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1709571128.2421494 pytest-filter-subpackage-0.2.0/tests/0000755000175100001770000000000000000000000020377 5ustar00runnerdocker00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571117.0 pytest-filter-subpackage-0.2.0/tests/conftest.py0000644000175100001770000000213000000000000022572 0ustar00runnerdocker00000000000000import pytest TEST_TEMPLATE = """ def test_{sub}_1(): assert True def test_{sub}_2(): assert '{sub}' == 'a' """ DOCS_TEMPLATE = """ Documentation for {sub} ======================= :: >>> a = 1 >>> b = 2 >>> a + b 3 """ @pytest.fixture def testpackage(testdir): # Fixture to make a test package with a docs and code folder pkg = testdir.mkdir('testpackage') pkg.join('__init__.py').write('') for sub in ('a', 'b', 'c'): pkg.mkdir(sub).join('__init__.py').write('') pkg.join(sub).mkdir('tests').join('__init__.py').write('') pkg.join(sub).join('tests').join(f'test_{sub}.py') \ .write(TEST_TEMPLATE.format(sub=sub)) pkg.join('c').mkdir('d').join('__init__.py').write('') pkg.join('c').join('d').mkdir('tests').join('__init__.py').write('') pkg.join('c').join('d').join('tests').join('test_d.py') \ .write(TEST_TEMPLATE.format(sub='d')) docs = testdir.mkdir('docs') docs.join('index.rst').write('') for sub in ('a', 'c'): docs.mkdir(sub).join('index.rst').write(DOCS_TEMPLATE.format(sub=sub)) ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571117.0 pytest-filter-subpackage-0.2.0/tests/test_filter_subpackage.py0000644000175100001770000000351400000000000025465 0ustar00runnerdocker00000000000000pytest_plugins = ['pytester'] def test_default(testdir, testpackage): # Make sure all code tests are picked up by default reprec = testdir.inline_run() reprec.assertoutcome(passed=5, failed=3) def test_with_rst(testdir, testpackage): # Make sure all rst tests are also picked up when using pytest-doctestplus testdir.makeini(""" [pytest] doctest_plus = enabled """) reprec = testdir.inline_run('--doctest-rst') reprec.assertoutcome(passed=7, failed=3) def test_flag_single_subpackage(testdir, testpackage): # Test -P with a single sub-package reprec = testdir.inline_run('-P a') reprec.assertoutcome(passed=2, failed=0) def test_flag_single_subpackage_with_rst(testdir, testpackage): # Test -P with a single sub-package including rst files testdir.makeini(""" [pytest] doctest_plus = enabled """) reprec = testdir.inline_run('-P a', '--doctest-rst') reprec.assertoutcome(passed=3, failed=0) def test_flag_multiple_subpackage(testdir, testpackage): # Test -P with several sub-packages reprec = testdir.inline_run('-P a,b') reprec.assertoutcome(passed=3, failed=1) def test_flag_multiple_subpackage_with_rst(testdir, testpackage): # Test -P with several sub-packages including rst files testdir.makeini(""" [pytest] doctest_plus = enabled """) reprec = testdir.inline_run('-P a,b', '--doctest-rst') reprec.assertoutcome(passed=4, failed=1) def test_flag_single_subpackage_partial(testdir, testpackage): # Check that -P c will collect tests in c.d reprec = testdir.inline_run('-P c') reprec.assertoutcome(passed=2, failed=2) def test_flag_single_subsubpackage(testdir, testpackage): # Check that -P c.d will not collect tests in c. reprec = testdir.inline_run('-P c.d') reprec.assertoutcome(passed=1, failed=1) ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1709571117.0 pytest-filter-subpackage-0.2.0/tox.ini0000644000175100001770000000211400000000000020546 0ustar00runnerdocker00000000000000[tox] envlist = py{38,39,310,311,312}-test codestyle requires = setuptools >= 30.3.0 pip >= 19.3.1 isolated_build = true [testenv] changedir = .tmp/{envname} description = run tests with pytest deps = pytestoldest: pytest==4.6.0 pytest50: pytest==5.0.* pytest51: pytest==5.1.* pytest52: pytest==5.2.* pytest53: pytest==5.3.* pytest60: pytest==6.0.* pytest61: pytest==6.1.* pytest62: pytest==6.2.* pytest70: pytest==7.0.* pytest71: pytest==7.1.* pytest72: pytest==7.2.* pytest73: pytest==7.3.* pytest74: pytest==7.4.* pytest80: pytest==8.0.* pytestdev: git+https://github.com/pytest-dev/pytest#egg=pytest pytestdev: git+https://github.com/scientific-python/pytest-doctestplus extras = test # Temporary measures to be able to test on 8.0.x in its RC cycle pip_pre = pytest80: true !pytest80: false commands = pip freeze pytest {toxinidir}/tests {posargs} [testenv:codestyle] skip_install = true description = check code style deps = flake8 commands = flake8 pytest_filter_subpackage tests --count