Created
January 10, 2017 18:36
-
-
Save wolever/ccc4551f39d5780c3f498b3ebc0fb9c5 to your computer and use it in GitHub Desktop.
Disable migrations while testing Django
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what are the side effects of disableing the migrations?