import sys

import django
from colour_runner.django_runner import ColourRunnerMixin
from django.conf import settings


settings.configure(
    DATABASES={
        'default': {
            'ENGINE': 'django.db.backends.sqlite3',
            'NAME': ':memory:',
        }
    },
    MIDDLEWARE_CLASSES=(),
    TEMPLATE_DIRS=('tests/templates',),
)


if django.VERSION >= (1, 7):
    django.setup()


try:
    from django.test.runner import DiscoverRunner
except ImportError:
    # Django < 1.6
    from discover_runner import DiscoverRunner


class Runner(ColourRunnerMixin, DiscoverRunner):
    pass

test_runner = Runner(verbosity=1)
failures = test_runner.run_tests(['tests'])
if failures:
    sys.exit(1)

import sys

import django
from colour_runner.django_runner import ColourRunnerMixin
from django.conf import settings


settings.configure(
    DATABASES={
        'default': {
            'ENGINE': 'django.db.backends.sqlite3',
            'NAME': ':memory:',
        }
    },
    MIDDLEWARE_CLASSES=(),
    TEMPLATES=[
        {
            'BACKEND': 'django.template.backends.django.DjangoTemplates',
            'APP_DIRS': False,
            'DIRS': ('tests/templates',),
        },
    ]
)


if django.VERSION >= (1, 7):
    django.setup()


try:
    from django.test.runner import DiscoverRunner
except ImportError:
    # Django < 1.6
    from discover_runner import DiscoverRunner


class Runner(ColourRunnerMixin, DiscoverRunner):
    pass

test_runner = Runner(verbosity=1)
failures = test_runner.run_tests(['tests'])
if failures:
    sys.exit(1)

Add new-style TEMPLATES setting for tests
Add new-style TEMPLATES setting for tests

  import sys
  
  import django
  from colour_runner.django_runner import ColourRunnerMixin
  from django.conf import settings
  
  
  settings.configure(
      DATABASES={
          'default': {
              'ENGINE': 'django.db.backends.sqlite3',
              'NAME': ':memory:',
          }
      },
      MIDDLEWARE_CLASSES=(),
-     TEMPLATE_DIRS=('tests/templates',),
+     TEMPLATES=[
+         {
+             'BACKEND': 'django.template.backends.django.DjangoTemplates',
+             'APP_DIRS': False,
+             'DIRS': ('tests/templates',),
+         },
+     ]
  )
  
  
  if django.VERSION >= (1, 7):
      django.setup()
  
  
  try:
      from django.test.runner import DiscoverRunner
  except ImportError:
      # Django < 1.6
      from discover_runner import DiscoverRunner
  
  
  class Runner(ColourRunnerMixin, DiscoverRunner):
      pass
  
  test_runner = Runner(verbosity=1)
  failures = test_runner.run_tests(['tests'])
  if failures:
      sys.exit(1)
  
Add new-style TEMPLATES setting for tests
## Code Before:
import sys

import django
from colour_runner.django_runner import ColourRunnerMixin
from django.conf import settings


settings.configure(
    DATABASES={
        'default': {
            'ENGINE': 'django.db.backends.sqlite3',
            'NAME': ':memory:',
        }
    },
    MIDDLEWARE_CLASSES=(),
    TEMPLATE_DIRS=('tests/templates',),
)


if django.VERSION >= (1, 7):
    django.setup()


try:
    from django.test.runner import DiscoverRunner
except ImportError:
    # Django < 1.6
    from discover_runner import DiscoverRunner


class Runner(ColourRunnerMixin, DiscoverRunner):
    pass

test_runner = Runner(verbosity=1)
failures = test_runner.run_tests(['tests'])
if failures:
    sys.exit(1)

## Instruction:
Add new-style TEMPLATES setting for tests
## Code After:
import sys

import django
from colour_runner.django_runner import ColourRunnerMixin
from django.conf import settings


settings.configure(
    DATABASES={
        'default': {
            'ENGINE': 'django.db.backends.sqlite3',
            'NAME': ':memory:',
        }
    },
    MIDDLEWARE_CLASSES=(),
    TEMPLATES=[
        {
            'BACKEND': 'django.template.backends.django.DjangoTemplates',
            'APP_DIRS': False,
            'DIRS': ('tests/templates',),
        },
    ]
)


if django.VERSION >= (1, 7):
    django.setup()


try:
    from django.test.runner import DiscoverRunner
except ImportError:
    # Django < 1.6
    from discover_runner import DiscoverRunner


class Runner(ColourRunnerMixin, DiscoverRunner):
    pass

test_runner = Runner(verbosity=1)
failures = test_runner.run_tests(['tests'])
if failures:
    sys.exit(1)
