Skip to content

Commit

Permalink
Fix test startup for Django==1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
rbarrois committed Apr 27, 2015
1 parent bb7939b commit 526293f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
4 changes: 3 additions & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2015 Raphaël Barrois

# factory.django needs a configured Django.
from .test_django import *

from .test_base import *
from .test_containers import *
from .test_declarations import *
from .test_django import *
from .test_fuzzy import *
from .test_helpers import *
from .test_using import *
Expand Down
40 changes: 21 additions & 19 deletions tests/test_django.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,13 @@

import os

import factory
import factory.django


try:
import django
except ImportError: # pragma: no cover
django = None

try:
from PIL import Image
except ImportError: # pragma: no cover
# Try PIL alternate name
try:
import Image
except ImportError:
# OK, not installed
Image = None


from .compat import is_python2, unittest, mock
from . import testdata
from . import tools


# Setup Django as soon as possible
if django is not None:
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tests.djapp.settings')

Expand All @@ -67,6 +49,26 @@
django_test = unittest



try:
from PIL import Image
except ImportError: # pragma: no cover
# Try PIL alternate name
try:
import Image
except ImportError:
# OK, not installed
Image = None


import factory
import factory.django

from .compat import is_python2, unittest, mock
from . import testdata
from . import tools


test_state = {}


Expand Down

0 comments on commit 526293f

Please sign in to comment.