From 93c075098cef8d612a7f9dee3fe627267749c4ac Mon Sep 17 00:00:00 2001 From: Joey Orlando Date: Thu, 10 Oct 2024 16:23:50 -0400 Subject: [PATCH] fix: fix tests failing because of `faker` (#5163) --- engine/common/utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/engine/common/utils.py b/engine/common/utils.py index a20fbfa1d..6a37344f2 100644 --- a/engine/common/utils.py +++ b/engine/common/utils.py @@ -23,6 +23,14 @@ # Faker that always returns unique values class UniqueFaker(factory.Faker): + def __init__(self, provider, **kwargs): + if provider == "pyint": + # https://faker.readthedocs.io/en/master/providers/faker.providers.python.html#faker.providers.python.Provider.pyint + # https://raintank-corp.slack.com/archives/C06K1MQ07GS/p1728589562495709?thread_ts=1728586969.283779&cid=C06K1MQ07GS + kwargs["max_value"] = 9_999_999 + + super().__init__(provider, **kwargs) + @classmethod def _get_faker(cls, locale=None): return super()._get_faker(locale).unique