Skip to content

Commit

Permalink
Add a Django config for running tests (#2536)
Browse files Browse the repository at this point in the history
* Add a Django config for running tests

* Rename test settings file to avoid automatic discovery by test runner

* Fix usage string
  • Loading branch information
hackdna committed Jan 25, 2018
1 parent 6045fac commit bea7f6d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions refinery/config/settings/quick_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Special Django config for testing

# DO NOT use for running the application server

# Speeds up test runs by skipping migrations
# Disables logging to provide a clean output of test results

# Usage: manage.py test --settings=config.settings.quick_test

from .base import * # NOQA

logging.disable(logging.CRITICAL)

# TODO: replace MIGRATION_MODULES with a dict after Django 1.9 upgrade
# https://simpleisbetterthancomplex.com/tips/2016/08/19/django-tip-12-disabling-migrations-to-speed-up-unit-tests.html


class DisableMigrations(object):
def __contains__(self, item):
return True

def __getitem__(self, item):
return 'notmigrations'


MIGRATION_MODULES = DisableMigrations()

0 comments on commit bea7f6d

Please sign in to comment.