Skip to main content

pytest-factoryboy-state

PyPI version Python versions Status tests pre-commit pre-commit.ci status Black

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

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.

Release files for pytest-factoryboy-state 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-factoryboy-state 1.0.0
File Size Uploaded
pytest-factoryboy-state-1.0.0.tar.gz 13.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-factoryboy-state 1.0.0
File Interpreter ABI Platform
pytest_factoryboy_state-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.7 kB

Release files / pytest-factoryboy-state-1.0.0.tar.gz

Download URL pytest-factoryboy-state-1.0.0.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c47d5abb5fe2db0c7cabe600a053747a62ccbfdb73c5e606ba96af86a18523f3
BLAKE2b-256 checksum
How to use checksums
b6114d7d458dbc2c48b25fe862f18eed9ea755073e1e5bd54812b2275cc48240
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

Release files / pytest_factoryboy_state-1.0.0-py3-none-any.whl

Download URL pytest_factoryboy_state-1.0.0-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c681eb917f70668f1f26aaf163d7d0dba812e1fe41ab52173634e92ba7124053
BLAKE2b-256 checksum
How to use checksums
dd1559be3436b9f5d91f65f23b4bed004933c732c0044d24d30307c32c8b0e6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page