summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polyconseil.fr>2016-09-01 14:29:34 +0200
committerRaphaël Barrois <raphael.barrois@polyconseil.fr>2016-09-01 14:29:34 +0200
commitc711af6a42326f07fdb14730c0211f4629b0b772 (patch)
tree1c7bdc6bc902b85bca542ff765ca777ef920f7be
parentee2350045b42744515848fcf92d1e7eca747e8c9 (diff)
downloadsemantic-version-c711af6a42326f07fdb14730c0211f4629b0b772.tar.gz
Fix deconstruct() tests under Pypy.
Pypy seems to deconstruct fields differently from Django, thus bringing in variations in the actual deconstruct() output.
-rw-r--r--tests/test_django.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/tests/test_django.py b/tests/test_django.py
index 93ea810..1c3c46a 100644
--- a/tests/test_django.py
+++ b/tests/test_django.py
@@ -5,6 +5,8 @@
from __future__ import unicode_literals
import unittest
+import sys
+
import semantic_version
from .setup_django import django_loaded
@@ -213,17 +215,25 @@ class FieldMigrationTests(DjangoTestCase):
partial=True,
coerce=True,
)
- self.assertEqual(
- field.deconstruct()[3],
- {'coerce': True, 'partial': True, 'max_length': 200},
- )
+ expected = {
+ 'coerce': True,
+ 'partial': True,
+ 'max_length': 200,
+ }
+ if hasattr(sys, 'pypy_version_info'):
+ # Django under Pypy adds this extra key.
+ expected['help_text'] = u''
+
+ self.assertEqual(field.deconstruct()[3], expected)
def test_spec_field(self):
field = django_fields.SpecField()
- self.assertEqual(
- field.deconstruct()[3],
- {'max_length': 200},
- )
+ expected = {'max_length': 200}
+ if hasattr(sys, 'pypy_version_info'):
+ # Django under Pypy adds this extra key.
+ expected['help_text'] = u''
+
+ self.assertEqual(field.deconstruct()[3], expected)
@unittest.skipIf(not django_loaded, "Django not installed")