How dsayling/pytest-configurex works
pytest-configurex is a small pytest plugin that loads typed settings from environment and .env files, then applies them unless standard CLI options override them. Its workflow is pytest hook → settings-class discovery/loading → pytest configuration; tests can retrieve the loaded settings through the configurex fixture. The source excerpts establish this wiring, but do not show every setting mapping or validation detail.
Main entry points: settings.py Typed settings · plugin.py Settings fixture · discovery.py Class discovery · cli_detection.py CLI detection
Components 9
Other components
- Test author
- pytest runner
- Environment inputs
- Plugin hooks
src/pytest_configurex/plugin.py - Class discovery
src/pytest_configurex/discovery.py - Typed settings
src/pytest_configurex/settings.py - CLI detection
src/pytest_configurex/cli_detection.py - Pytest config
- Settings fixture
src/pytest_configurex/plugin.py
Connections 13
- Test author → Environment inputs: provides values
- Test author → pytest runner: runs tests
- pytest runner → Plugin hooks: calls hooks
- Plugin hooks → Class discovery: loads settings
- Class discovery → Typed settings: selects and loads
- Environment inputs → Typed settings: supplies values
- Typed settings → CLI detection: checks overrides
- Pytest config → CLI detection: provides arguments
- Typed settings → Pytest config: applies options
- Typed settings → Pytest config: stores instance
- pytest runner → Settings fixture: requests fixture
- Settings fixture → Pytest config: reads stored settings
- Test author → Settings fixture: uses in tests