factory_boy icon indicating copy to clipboard operation
factory_boy copied to clipboard

Ability to reset all iterators on a factory

Open gwax opened this issue 6 years ago • 0 comments

The problem

Please describe the problem you're encountering (e.g "It's very complex to do [...]")

Factory.reset_sequence() allows for the reset of all sequences on a factory but there is no equivalent for Iterators. This makes it difficult to fully reset a factory without avoiding Iterator or calling Iterator.reset() on every Iterator attached to the factory.

Proposed solution

Please provide some wild idea you think could solve this issue. It's much easier to work from an existing suggestion :)

  • Add a reset_iterator() function to factories that will reset all iterators.
  • Add a reset_all()/reset() function to factories that will fully reset all of their state
  • Have reset_sequence() reset Iterators as well.

Extra notes

Any notes you feel interesting to include: alternatives you've considered, reasons to include the change, anything!

gwax avatar Nov 07 '18 20:11 gwax