Skip to main content

Simple factoryboy random state management

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest-factoryboy-state-1.0.0.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

pytest_factoryboy_state-1.0.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file pytest-factoryboy-state-1.0.0.tar.gz.

File metadata

  • Download URL: pytest-factoryboy-state-1.0.0.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for pytest-factoryboy-state-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c47d5abb5fe2db0c7cabe600a053747a62ccbfdb73c5e606ba96af86a18523f3
MD5 fce536f40aa36342ac607cfa580c8bc1
BLAKE2b-256 b6114d7d458dbc2c48b25fe862f18eed9ea755073e1e5bd54812b2275cc48240

See more details on using hashes here.

File details

Details for the file pytest_factoryboy_state-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_factoryboy_state-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for pytest_factoryboy_state-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c681eb917f70668f1f26aaf163d7d0dba812e1fe41ab52173634e92ba7124053
MD5 d3ade61af3cf4987b5dde417b363d3e5
BLAKE2b-256 dd1559be3436b9f5d91f65f23b4bed004933c732c0044d24d30307c32c8b0e6e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page