Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support testing migrations in tests #593

Closed
asfaltboy opened this issue May 8, 2018 · 5 comments
Closed

Support testing migrations in tests #593

asfaltboy opened this issue May 8, 2018 · 5 comments

Comments

@asfaltboy
Copy link
Contributor

As in this gist: https://gist.github.com/blueyed/4fb0a807104551f103e6 , it would be great to get this as part of pytest-django, or otherwise as a separate plugin.

@TauPan 's fork of my fixture gist worked pretty good for me in latest Django: https://gist.github.com/TauPan/aec52e398d7288cb5a62895916182a9f

Some things that are broken or unsupported that would be nice to have (or at least need to be documented if we include this "as is"):

  • No support for capturing exceptions during migration with pytest.raises
  • Detecting and updating settings.MIGRATION_MODULES for a migration test
  • No support for factoryboy (of course)

This ticket is mainly for discussing better ways of testing django data migrations in pytest.

@MRigal
Copy link

MRigal commented Dec 13, 2018

This is actually a very nice feature, that was started by @blueyed some years ago. What about trying to include this to pytest-django?

@skarzi
Copy link

skarzi commented Jul 19, 2019

Hi 👋
I am already working on similar package for testing Django's migrations:

https://github.com/skarzi/django-test-migrations

It's still in progress, because I am struggling with some issues, for instance this listed in issue description, but I will be really grateful for any suggestions and help from anyone

@tadeoos
Copy link

tadeoos commented Feb 21, 2020

@skarzi have you seen https://pypi.org/project/django-test-migrations?
I think it has a bit more pytesty api...
It would be cool to have it as a part of standard pyetst-django imho

@skarzi
Copy link

skarzi commented Feb 23, 2020

I haven't seen this project, but it's almost identical, so we can use it if you guys prefer 👍

@asfaltboy
Copy link
Contributor Author

I think I'm going to switch to using django-test-migrations instead of maintaining my own migrator fixture; and thus can close this issue. Please feel free to reopen if there is more to discuss in relation to pytest-django.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants