parent
7221374414
commit
2d98bb3320
@ -1,37 +0,0 @@
|
||||
From 3bb7b0923a197f40ba9d3463c9340c2525c3f3ff Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
Date: Mon, 16 Jul 2018 14:23:01 -0700
|
||||
Subject: [PATCH] Fix django tests
|
||||
|
||||
When django isn't installed it shouldn't evaluate django.VERSION
|
||||
otherwise it will crash. decorators are always evaluated, so this needs
|
||||
to be short-circuited.
|
||||
---
|
||||
tests/test_django.py | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tests/test_django.py b/tests/test_django.py
|
||||
index 1c3c46a..489caf4 100644
|
||||
--- a/tests/test_django.py
|
||||
+++ b/tests/test_django.py
|
||||
@@ -139,7 +139,7 @@ class DjangoFieldTestCase(unittest.TestCase):
|
||||
self.assertEqual(Version('23.0.0'), obj2.version)
|
||||
self.assertEqual(Version('0.1.2+3.4.5-6', partial=True), obj2.partial)
|
||||
|
||||
- @unittest.skipIf(django.VERSION[:2] < (1, 8), "Django<1.8 casts values on setattr")
|
||||
+ @unittest.skipIf(django_loaded and django.VERSION[:2] < (1, 8), "Django<1.8 casts values on setattr")
|
||||
def test_invalid_input(self):
|
||||
v = models.VersionModel(version='0.1.1', spec='blah')
|
||||
self.assertRaises(ValueError, v.full_clean)
|
||||
@@ -147,7 +147,7 @@ class DjangoFieldTestCase(unittest.TestCase):
|
||||
v2 = models.VersionModel(version='0.1', spec='==0.1.1,!=0.1.1-alpha')
|
||||
self.assertRaises(ValueError, v2.full_clean)
|
||||
|
||||
- @unittest.skipUnless(django.VERSION[:2] < (1, 8), "Django>=1.8 doesn't mangle setattr")
|
||||
+ @unittest.skipUnless(django_loaded and django.VERSION[:2] < (1, 8), "Django>=1.8 doesn't mangle setattr")
|
||||
def test_invalid_input_full_clean(self):
|
||||
self.assertRaises(ValueError, models.VersionModel, version='0.1.1', spec='blah')
|
||||
self.assertRaises(ValueError, models.VersionModel, version='0.1', spec='==0.1.1,!=0.1.1-alpha')
|
||||
--
|
||||
2.17.1
|
||||
|
Loading…
Reference in new issue