Get skipIf without installing unittest2

In Python 2.7+, unittest *is* unittest2. We prefer this one. But in
Python 2.6, we can get skipIf from django.utils.unittest, provided
Django is 1.8 or older.
This commit is contained in:
John R Dietrick 2016-01-03 01:21:29 -05:00
parent 4fe1c74b35
commit 66bb6a8725
2 changed files with 6 additions and 3 deletions

View file

@ -6,4 +6,3 @@ dj-email-url
dj-search-url
django-cache-url>=1.0.0
six
unittest2

View file

@ -1,13 +1,17 @@
import os
import subprocess
import sys
import unittest2
from django import VERSION as DJANGO_VERSION
from django.conf import global_settings
from django.test import TestCase
from django.core.exceptions import ImproperlyConfigured
if sys.version_info >= (2, 7):
from unittest import skipIf
else:
from django.utils.unittest import skipIf
from mock import patch
from configurations.importer import ConfigurationImporter
@ -111,7 +115,7 @@ class MainTests(TestCase):
stdout=subprocess.PIPE)
self.assertIn('--configuration', proc.communicate()[0].decode('utf-8'))
@unittest2.skipIf(DJANGO_VERSION >= (1, 10), 'only applies to Django < 1.10')
@skipIf(DJANGO_VERSION >= (1, 10), 'only applies to Django < 1.10')
def test_deprecated_option_list_command(self):
"""
Verify that the configuration option is correctly added to any