pytest-factoryboy-state 1.0.0

Creator: codyrutscher

Last updated:

Add to Cart

Description:

pytestfactoryboystate 1.0.0

pytest plugin to manage random state in factory_boy.

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.

Features

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



Requirements

Python > 3.7
pytest
factory_boy



Installation
You can install “pytest-factoryboy-state” via pip from PyPI:
$ pip install pytest-factoryboy-state


Usage
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.


Contributing
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.


License
Distributed under the terms of the MIT license, “pytest-factoryboy-state” is free and open source software


Issues
If you encounter any problems, please file an issue along with a detailed description.

This pytest plugin was generated with Cookiecutter along with @hackebrot’s cookiecutter-pytest-plugin template.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.