Skip to content

Commit

Permalink
Patches issue #993
Browse files Browse the repository at this point in the history
  • Loading branch information
danjer committed Dec 29, 2023
1 parent dca0bb4 commit 357c719
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions factory/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,8 +664,23 @@ def create(cls, **kwargs):
raise errors.UnsupportedStrategy()


class DictFactoryOptions(FactoryOptions):

def _get_counter_reference(self):
"""Identify which factory should be used for a shared counter."""

# When _setup_next_sequence is overridden in the factory, it should get a new counter
if '_setup_next_sequence' in self.factory.__dict__:
return self
else:
return super()._get_counter_reference()


class BaseDictFactory(Factory):
"""Factory for dictionary-like classes."""

_options_class = DictFactoryOptions

class Meta:
abstract = True

Expand Down

0 comments on commit 357c719

Please sign in to comment.