-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
No parameters are generated for model-only parameters. We often have Django model defaults which we don't override in factories, but do override in tests. For example:
class Book(models.Model):
title = models.CharField(max_length=255, default='My title')
class BookFactory(factory.DjangoModelFactory):
class Meta:
model = Book
register(BookFactory)
@pytest.mark.django_db
@pytest.mark.parametrize('book__title', ['My other title'])
def test_title(book):
assert book.title == 'My other title'This results in ValueError: <function test_title at 0x7efe970a2488> uses no fixture 'book__title'
If I add the title to the BookFactory it does work.
Result of pip freeze:
Django==1.9.6
factory-boy==2.7.0
fake-factory==0.5.7
inflection==0.3.1
ipaddress==1.0.16
py==1.4.31
pytest==2.9.1
pytest-django==2.9.1
pytest-factoryboy==1.1.6
python-dateutil==2.5.3
six==1.10.0
ivirabyan
Metadata
Metadata
Assignees
Labels
No labels