From 0a35ba85329803ef39028edb238d5b5241585128 Mon Sep 17 00:00:00 2001 From: Raphaƫl Barrois Date: Thu, 27 Jun 2013 13:19:02 +0200 Subject: tests: Safer againt not-installed Django. --- tests/test_django.py | 8 ++++++-- 1 file 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.") -- cgit v1.2.3