Pytest Fixtures

Half of the power of PyTest is its Fixtures. pytest-prosper comes with some baked-in features that every Prosper project should find useful.

Secret Management

Secret management is challenging, but prosper.common.prosper_cli has a built in --secret-cfg and these fixtures mimic that api.

pytest.ini
[pytest]
config_path = path/to/app.cfg
python setup.py test --secret-cfg=secrets.ini
import pytest

def test_something_secret(secret_cfg):
    handle = login(
        username=secret_cfg.get_option('credentials', 'username'),
        password=secret_cfg.get_option('credentials', 'password'),
    )

Though the app.cfg should be in the repository, secrets.ini should not be. By providing a secrets.ini file at test time, secrets can remain unpaired and safe.