Skip to content

Instantly share code, notes, and snippets.

@wolever
Created January 10, 2017 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wolever/ccc4551f39d5780c3f498b3ebc0fb9c5 to your computer and use it in GitHub Desktop.
Save wolever/ccc4551f39d5780c3f498b3ebc0fb9c5 to your computer and use it in GitHub Desktop.
Disable migrations while testing Django
# A quick but effective hack for disabling migrations while running Django tests.
# Put this in settings.py below the existing MIGRATION_MODULES definition, if that exists:
if "test" in sys.argv[1:]:
class DisableMigrations(object):
def __contains__(self, item):
return True
def __getitem__(self, item):
return "notmigrations"
MIGRATION_MODULES = DisableMigrations()
@abhishekwithfero
Copy link

what are the side effects of disableing the migrations?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment