model-bakers / model_bakery

Object factory for Django
https://model-bakery.readthedocs.io/en/latest/
Other
846 stars 85 forks source link

:sparkles: Adds global seeding to baker #426

Closed nefrob closed 1 year ago

nefrob commented 1 year ago

Describe the change Adds baker random generation seeding. This allows for repeatable random generation within baker fixtures independently of other packages/system random. Future support could be added to seed individual instances of baker (like faker does).

After merging this a follow up PR could add baker seeding to pytest-randomly.

Re issue https://github.com/model-bakers/model_bakery/issues/380.

PR Checklist

nefrob commented 1 year ago

Ah mypy doesn't like the sentinel default re: https://github.com/model-bakers/model_bakery/actions/runs/5569452807/jobs/10179571748?pr=426.

I will also update make lint to run mypy locally.

nefrob commented 1 year ago

Follow up in pytest-randomly released here :https://github.com/pytest-dev/pytest-randomly/releases/tag/3.14.0.