pytest plugin for configuration profiles
Project description
pytest_profiles
pytest plugin to create configuration profiles.
Installation
$ pip install pytest_profiles
Usage
Define your pytest configurations in a conftest.py
.
# conftest.py
from pytest_profiles import profile
from _pytest.config import Config
@profile(autouse=True)
def default(config: Config) -> None:
"""
sets pytest configuration options
which are always applied (autouse=True)
"""
config.option.verbose = 1
@profile
def custom(config: Config) -> None:
"""
sets pytest configuration options
only when `--profile custom` argument is applied.
"""
config.option.newfirst = True
config.option.failedfirst = True
activate profiles by passing command line arguments to pytest
# pytest runs with verbosity=1 by default
$ pytest
# pytest runs new and failed tests first
$ pytest --profile custom
It is also possible to define dependencies between profiles
# conftest.py
from pytest_profiles import profile
from _pytest.config import Config
@profile
def base(config: Config) -> None:
config.option.newfirst = True
config.option.failedfirst = True
@profile(uses=["base"])
def sub(config: Config) -> None:
"""the sub profile also includes the configuration of the base profile."""
config.option.verbose = 1
see conftest.py for more examples.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for pytest_profiles-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ebb66b55720cc8376bfe1c33ef764b7f73378395ec7288a9454b9d632bdd13b |
|
MD5 | 64dabf87089f93b5dee7c95ce678d725 |
|
BLAKE2b-256 | 87dc79fc8a33fbd30c50556be76b8f3b83b24b315d45eb51162d1aa4bdded517 |