pytest-fixture-config is a pytest plugin that provides utility functions for configuring Py.test fixtures. It enables the creation of simple configuration objects for fixtures, allowing tests to be skipped dynamically if required configuration variables are not set. The library is part of the larger `man-group/pytest-plugins` monorepo, is currently in version 1.8.0, and maintains an active release cadence with frequent updates.
pip install pytest-fixture-configVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to define a configuration class using `pytest_fixture_config.Config`, populate it from environment variables, and use the `requires_config` decorator to create fixtures that conditionally skip tests if necessary configuration values are not provided. This ensures tests requiring specific setups only run when their prerequisites are met.
Upgrade your Python environment to version 3.6 or newer.
Update any code directly importing or relying on the standalone `mock` package to use `unittest.mock` instead.
Refactor any code interacting with `pytest-fixture-config` that might have implicitly relied on `path.py` objects, migrating to `pathlib.Path` objects.
Verify `pip install pytest-fixture-config` completed successfully. If using a `conftest.py`, ensure `pytest_plugins = ['pytest_fixture_config']` is present if auto-discovery fails.
Run `pip install pytest-fixture-config` to install the package.
Check the spelling of the fixture name, ensure the fixture is defined within a `conftest.py` in an appropriate directory, or explicitly imported if it's not a root-level plugin fixture. If using `pytest_plugins = ['pytest_fixture_config']`, verify it's correctly specified.
Add the 'new_attribute' to the `__slots__` tuple in your `MyAppConfig` class definition. Remember that classes using `__slots__` do not support dynamic attribute assignment outside of the defined slots.