summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polyconseil.fr>2013-06-27 13:19:02 +0200
committerRaphaël Barrois <raphael.barrois@polyconseil.fr>2013-06-27 13:19:02 +0200
commit0a35ba85329803ef39028edb238d5b5241585128 (patch)
tree90a3f4f211addcefc24a3e357322a7f2532ab9cb
parent79566ad0c485d6fd7b881ba783b894f2640f98c9 (diff)
downloadfactory-boy-0a35ba85329803ef39028edb238d5b5241585128.tar
factory-boy-0a35ba85329803ef39028edb238d5b5241585128.tar.gz
tests: Safer againt not-installed Django.
-rw-r--r--tests/test_django.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/test_django.py b/tests/test_django.py
index 4ae2a58..05ee961 100644
--- a/tests/test_django.py
+++ b/tests/test_django.py
@@ -64,6 +64,8 @@ else: # pragma: no cover
models = Fake()
models.StandardModel = Fake
models.NonIntegerPk = Fake
+ models.WithFile = Fake
+ models.WithImage = Fake
test_state = {}
@@ -106,13 +108,15 @@ class NonIntegerPkFactory(factory.django.DjangoModelFactory):
class WithFileFactory(factory.django.DjangoModelFactory):
FACTORY_FOR = models.WithFile
- afile = factory.django.FileField()
+ if django is not None:
+ afile = factory.django.FileField()
class WithImageFactory(factory.django.DjangoModelFactory):
FACTORY_FOR = models.WithImage
- animage = factory.django.ImageField()
+ if django is not None:
+ animage = factory.django.ImageField()
@unittest.skipIf(django is None, "Django not installed.")