Open
Description
It'd be nice to be able to expose a fixture (maybe the factory fixture?) that can be invoked in the test invocation.
Here's a few use cases:
- creating the object when using a decorator, e.g.
factory.django.mute_signals(signals.post_save)
- create the object imperatively in the test body, for example if you use
@pytest.mark.django_db(transactional=True)
, and you need to create your object within adjango.db.transaction.atomic()
context manager.
class Book:
name: str
class BookFactory(Factory):
name = "foo"
@pytest.mark.parametrize("book__name", ["bar"])
def test_book_initialise_later(book_factory):
book = book_factory()
assert book.name == bar
Metadata
Metadata
Assignees
Labels
No labels