You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, y'all! I set up pytest on my Django project this evening. I was/am hoping to replace my use of the unittest-derived TestCase defined in this project with the tp fixture made available by pytest plugin.
Judging by plugin.py, it looks like it's not possible to set a custom UserFactory for the fixture like you can for the TestCase.
One possible thought to fix this would be to expose a pytest configuration option that would set a module path to the UserFactory (e.g., myapp.factories.UserFactory) and load that class onto the t.user_factory attribute when the tp fixture creates the TestCase.
Thanks for the great project. I really enjoy the extensions that test plus provides.
The text was updated successfully, but these errors were encountered:
Hi, y'all! I set up pytest on my Django project this evening. I was/am hoping to replace my use of the unittest-derived
TestCase
defined in this project with thetp
fixture made available by pytest plugin.Judging by plugin.py, it looks like it's not possible to set a custom UserFactory for the fixture like you can for the
TestCase
.It would be nice to be able to define this for the
tp
fixture too. Without this ability,tp.make_user
is limited to theUser.objects.create_user
call on https://github.com/revsys/django-test-plus/blob/master/test_plus/test.py#L266.One possible thought to fix this would be to expose a pytest configuration option that would set a module path to the UserFactory (e.g.,
myapp.factories.UserFactory
) and load that class onto thet.user_factory
attribute when thetp
fixture creates theTestCase
.Thanks for the great project. I really enjoy the extensions that test plus provides.
The text was updated successfully, but these errors were encountered: