Permalink
Browse files

Require unittest2 for running tests. This comes packaged with more re…

…cent versions of Django.
  • Loading branch information...
1 parent 75f429f commit 2f5df7061685eab4157a541e29cca2aa0e52cad3 @mlavin mlavin committed Jul 24, 2012
Showing with 15 additions and 1 deletion.
  1. +2 −1 buildout.cfg
  2. +13 −0 src/moderation/tests/utils/__init__.py
View
@@ -7,6 +7,7 @@ eggs =
ipdb
pep8
mock
+ unittest2
[versions]
djangorecipe = 0.23.1
@@ -41,4 +42,4 @@ projectegg = example_project
project = example_project
test = moderation
testrunner = test-1.4
-eggs = ${buildout:eggs}
+eggs = ${buildout:eggs}
@@ -1,3 +1,16 @@
+import sys
+
+try:
+ from django.utils import unittest
+except ImportError:
+ # Django < 1.3
+ try:
+ import unittest2 as unittest
+ except ImportError:
+ if sys.version_info >= (2.7):
+ import unittest
+ else:
+ raise ImportError('unittest2 is required to run the tests.')
def setup_moderation(models=[]):

0 comments on commit 2f5df70

Please sign in to comment.