Simple factoryboy random state management
factory_boy uses randomness in order to generate its fuzzed values which makes it hard to reproduce tests which fail due to a fuzzed value. This plugin shows the random state used by factory_boy (and faker) when there are test failurs. And allows to run the tests with a specific random state.
- Show random state on test failures using cli option --show-state or by setting an environment variable.
- Set random state through environment variable or with cli option --set-state
$ pip install pytest-factoryboy-state
Show the random state of factoryboy on test failure with:
$ pytest --show-state
Or by defining the environment variable SHOW_FACTORYBOY_STATE to True.
Rerun the tests with a given state:
$ pytest --set-state=<factoryboy_state>
You can also set the environment variable FACTORYBOY_STATE to the state and run pytest as usual.
Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.
Distributed under the terms of the MIT license, “pytest-factoryboy-state” is free and open source software
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Hashes for pytest-factoryboy-state-1.0.0.tar.gz
Hashes for pytest_factoryboy_state-1.0.0-py3-none-any.whl