Got following exception from factory-boy
during running my pytests:
def generate(self, params):
> locale = params.pop('locale')
E KeyError: 'locale'
How to solve that issue? Everything worked few days ago, my code wasn't changed.
Here is the code example of what :
import factory
from django.db import models
class MyModel(models.Model):
name = models.CharField(max_length=100)
price = models.PositiveIntegerField()
is_cheat = models.BooleanField()
class MyModelFactory(factory.django.DjangoModelFactory):
class Meta:
model = MyModel
name = factory.Faker("name")
is_cheap = factory.Faker("boolean")
price = factory.Maybe("is_cheap", yes_declaration=factoryFaker("pyint", max_value=10), no_declaration=factory.Faker("pyint", min_value=100))
In faker.py I see that there is no default value in
.pop()
:But not sure if it should be there. Here is the comment of author of
factory-boy
with explanation of the situation.Looks like there is a bug in
3.1.0
, downgrading to3.0.1
should help. At least temporarily, while they haven't fixed that.