summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2019-08-18 18:45:16 +0200
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2019-08-24 15:13:09 +0200
commitea98f9fb7c76264df5e600ed597b79713e6cb2ce (patch)
tree22f774aa4b31d97554d550b4ac40dd7c4b7b12f8 /tests
parent65d76a46cb1898d9a0dc5c20baf9e014fe974fd8 (diff)
downloadsemantic-version-ea98f9fb7c76264df5e600ed597b79713e6cb2ce.tar.gz
Drop support for Python<3.4.
Diffstat (limited to 'tests')
-rw-r--r--tests/compat.py14
-rw-r--r--tests/django_test_app/__init__.py19
-rw-r--r--tests/setup_django.py13
-rwxr-xr-xtests/test_base.py3
-rw-r--r--tests/test_django.py2
-rw-r--r--tests/test_spec.py2
6 files changed, 13 insertions, 40 deletions
diff --git a/tests/compat.py b/tests/compat.py
deleted file mode 100644
index f3ef508..0000000
--- a/tests/compat.py
+++ /dev/null
@@ -1,14 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) The python-semanticversion project
-# This code is distributed under the two-clause BSD License.
-
-import sys
-
-is_python2 = (sys.version_info[0] == 2)
-
-
-try: # pragma: no cover
- import unittest2 as unittest
-except ImportError: # pragma: no cover
- import unittest
-
diff --git a/tests/django_test_app/__init__.py b/tests/django_test_app/__init__.py
index 0f94470..4506810 100644
--- a/tests/django_test_app/__init__.py
+++ b/tests/django_test_app/__init__.py
@@ -9,22 +9,3 @@ try: # pragma: no cover
except ImportError: # pragma: no cover
django_loaded = False
-
-if django_loaded: # pragma: no cover
- if not settings.configured:
- settings.configure(
- DATABASES={
- 'default': {
- 'ENGINE': 'django.db.backends.sqlite3',
- 'NAME': 'tests/db/test.sqlite',
- }
- },
- INSTALLED_APPS=[
- 'tests.django_test_app',
- ],
- MIDDLEWARE_CLASSES=[],
- )
- # https://docs.djangoproject.com/en/dev/releases/1.7/#app-loading-changes
- if django.VERSION >= (1, 7):
- from django.apps import apps
- apps.populate(settings.INSTALLED_APPS)
diff --git a/tests/setup_django.py b/tests/setup_django.py
index e0469bc..6a220df 100644
--- a/tests/setup_django.py
+++ b/tests/setup_django.py
@@ -13,9 +13,18 @@ if django_loaded:
from django.conf import settings
if not settings.configured:
settings.configure(
- DATABASES={'default': {'ENGINE': 'django.db.backends.sqlite3'}},
- INSTALLED_APPS=['tests.django_test_app'],
+ DATABASES={
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': 'tests/db/test.sqlite',
+ }
+ },
+ INSTALLED_APPS=[
+ 'tests.django_test_app',
+ ],
MIDDLEWARE_CLASSES=[],
)
django.setup()
+ from django.apps import apps
+ apps.populate(settings.INSTALLED_APPS)
diff --git a/tests/test_base.py b/tests/test_base.py
index a1255c3..7ab3fba 100755
--- a/tests/test_base.py
+++ b/tests/test_base.py
@@ -5,7 +5,7 @@
"""Test the various functions from 'base'."""
-from .compat import unittest, is_python2
+import unittest
from semantic_version import base
@@ -226,7 +226,6 @@ class VersionTestCase(unittest.TestCase):
]))
)
- @unittest.skipIf(is_python2, "Comparisons to other objects are broken in Py2.")
def test_invalid_comparisons(self):
v = base.Version('0.1.0')
with self.assertRaises(TypeError):
diff --git a/tests/test_django.py b/tests/test_django.py
index d9afd8f..b61b64e 100644
--- a/tests/test_django.py
+++ b/tests/test_django.py
@@ -2,8 +2,6 @@
# Copyright (c) The python-semanticversion project
# This code is distributed under the two-clause BSD License.
-from __future__ import unicode_literals
-
import unittest
import sys
diff --git a/tests/test_spec.py b/tests/test_spec.py
index 43c9d6a..cd5d2ce 100644
--- a/tests/test_spec.py
+++ b/tests/test_spec.py
@@ -5,7 +5,7 @@
"""Test conformance to the specs."""
-from .compat import unittest, is_python2
+import unittest
import semantic_version