diff -u -Naur -x .svn -x .DS_Store -x test -x '*.pyc' -w django/utils/unittest/__init__.py /Users/myk/Downloads/unittest2-0.5.1/unittest2/__init__.py
old
|
new
|
|
26 | 26 | SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
27 | 27 | """ |
28 | 28 | |
29 | | import sys |
30 | | |
31 | | # Django hackery to load the appropriate version of unittest |
32 | | |
33 | | try: |
34 | | # check the system path first |
35 | | from unittest2 import * |
36 | | except ImportError: |
37 | | if sys.version_info >= (2,7): |
38 | | # unittest2 features are native in Python 2.7 |
39 | | from unittest import * |
40 | | else: |
41 | | # otherwise use our bundled version |
42 | 29 | __all__ = ['TestResult', 'TestCase', 'TestSuite', |
43 | 30 | 'TextTestRunner', 'TestLoader', 'FunctionTestCase', 'main', |
44 | 31 | 'defaultTestLoader', 'SkipTest', 'skip', 'skipIf', 'skipUnless', |
… |
… |
|
50 | 37 | __all__.extend(['getTestCaseNames', 'makeSuite', 'findTestCases']) |
51 | 38 | |
52 | 39 | |
53 | | from django.utils.unittest.collector import collector |
54 | | from django.utils.unittest.result import TestResult |
55 | | from django.utils.unittest.case import \ |
56 | | TestCase, FunctionTestCase, SkipTest, skip, skipIf,\ |
| 40 | from unittest2.collector import collector |
| 41 | from unittest2.result import TestResult |
| 42 | from unittest2.case import ( |
| 43 | TestCase, FunctionTestCase, SkipTest, skip, skipIf, |
57 | 44 | skipUnless, expectedFailure |
58 | | |
59 | | from django.utils.unittest.suite import BaseTestSuite, TestSuite |
60 | | from django.utils.unittest.loader import \ |
61 | | TestLoader, defaultTestLoader, makeSuite, getTestCaseNames,\ |
| 45 | ) |
| 46 | from unittest2.suite import BaseTestSuite, TestSuite |
| 47 | from unittest2.loader import ( |
| 48 | TestLoader, defaultTestLoader, makeSuite, getTestCaseNames, |
62 | 49 | findTestCases |
63 | | |
64 | | from django.utils.unittest.main import TestProgram, main, main_ |
65 | | from django.utils.unittest.runner import TextTestRunner, TextTestResult |
| 50 | ) |
| 51 | from unittest2.main import TestProgram, main, main_ |
| 52 | from unittest2.runner import TextTestRunner, TextTestResult |
66 | 53 | |
67 | 54 | try: |
68 | | from django.utils.unittest.signals import\ |
| 55 | from unittest2.signals import ( |
69 | 56 | installHandler, registerResult, removeResult, removeHandler |
| 57 | ) |
70 | 58 | except ImportError: |
71 | 59 | # Compatibility with platforms that don't have the signal module |
72 | 60 | pass |
diff -u -Naur -x .svn -x .DS_Store -x test -x '*.pyc' -w django/utils/unittest/__main__.py /Users/myk/Downloads/unittest2-0.5.1/unittest2/__main__.py
old
|
new
|
|
6 | 6 | |
7 | 7 | __unittest = True |
8 | 8 | |
9 | | from django.utils.unittest.main import main_ |
| 9 | from unittest2.main import main_ |
10 | 10 | main_() |
diff -u -Naur -x .svn -x .DS_Store -x test -x '*.pyc' -w django/utils/unittest/case.py /Users/myk/Downloads/unittest2-0.5.1/unittest2/case.py
old
|
new
|
|
7 | 7 | import unittest |
8 | 8 | import warnings |
9 | 9 | |
10 | | from django.utils.unittest import result |
11 | | from django.utils.unittest.util import\ |
12 | | safe_repr, safe_str, strclass,\ |
| 10 | from unittest2 import result |
| 11 | from unittest2.util import ( |
| 12 | safe_repr, safe_str, strclass, |
13 | 13 | unorderable_list_difference |
| 14 | ) |
14 | 15 | |
15 | | from django.utils.unittest.compatibility import wraps |
| 16 | from unittest2.compatibility import wraps |
16 | 17 | |
17 | 18 | __unittest = True |
18 | 19 | |
… |
… |
|
479 | 480 | excName = excClass.__name__ |
480 | 481 | else: |
481 | 482 | excName = str(excClass) |
482 | | raise self.failureException("%s not raised" % excName) |
| 483 | raise self.failureException, "%s not raised" % excName |
483 | 484 | |
484 | 485 | def _getAssertEqualityFunc(self, first, second): |
485 | 486 | """Get a detailed comparison function for the types of the two args. |
… |
… |
|
831 | 832 | self.fail(self._formatMessage(msg, standardMsg)) |
832 | 833 | |
833 | 834 | def assertDictEqual(self, d1, d2, msg=None): |
834 | | self.assertTrue(isinstance(d1, dict), 'First argument is not a dictionary') |
835 | | self.assertTrue(isinstance(d2, dict), 'Second argument is not a dictionary') |
| 835 | self.assert_(isinstance(d1, dict), 'First argument is not a dictionary') |
| 836 | self.assert_(isinstance(d2, dict), 'Second argument is not a dictionary') |
836 | 837 | |
837 | 838 | if d1 != d2: |
838 | 839 | standardMsg = '%s != %s' % (safe_repr(d1, True), safe_repr(d2, True)) |
… |
… |
|
909 | 910 | |
910 | 911 | def assertMultiLineEqual(self, first, second, msg=None): |
911 | 912 | """Assert that two multi-line strings are equal.""" |
912 | | self.assertTrue(isinstance(first, basestring), ( |
| 913 | self.assert_(isinstance(first, basestring), ( |
913 | 914 | 'First argument is not a string')) |
914 | | self.assertTrue(isinstance(second, basestring), ( |
| 915 | self.assert_(isinstance(second, basestring), ( |
915 | 916 | 'Second argument is not a string')) |
916 | 917 | |
917 | 918 | if first != second: |
… |
… |
|
997 | 998 | excName = expected_exception.__name__ |
998 | 999 | else: |
999 | 1000 | excName = str(expected_exception) |
1000 | | raise self.failureException("%s not raised" % excName) |
| 1001 | raise self.failureException, "%s not raised" % excName |
| 1002 | |
1001 | 1003 | |
1002 | 1004 | def assertRegexpMatches(self, text, expected_regexp, msg=None): |
1003 | 1005 | """Fail the test unless the text matches the regular expression.""" |
diff -u -Naur -x .svn -x .DS_Store -x test -x '*.pyc' -w django/utils/unittest/collector.py /Users/myk/Downloads/unittest2-0.5.1/unittest2/collector.py
old
|
new
|
|
1 | 1 | import os |
2 | 2 | import sys |
3 | | from django.utils.unittest.loader import defaultTestLoader |
| 3 | from unittest2.loader import defaultTestLoader |
4 | 4 | |
5 | 5 | def collector(): |
6 | 6 | # import __main__ triggers code re-execution |
diff -u -Naur -x .svn -x .DS_Store -x test -x '*.pyc' -w django/utils/unittest/loader.py /Users/myk/Downloads/unittest2-0.5.1/unittest2/loader.py
old
|
new
|
|
9 | 9 | |
10 | 10 | from fnmatch import fnmatch |
11 | 11 | |
12 | | from django.utils.unittest import case, suite |
| 12 | from unittest2 import case, suite |
13 | 13 | |
14 | 14 | try: |
15 | 15 | from os.path import relpath |
16 | 16 | except ImportError: |
17 | | from django.utils.unittest.compatibility import relpath |
| 17 | from unittest2.compatibility import relpath |
18 | 18 | |
19 | 19 | __unittest = True |
20 | 20 | |
diff -u -Naur -x .svn -x .DS_Store -x test -x '*.pyc' -w django/utils/unittest/main.py /Users/myk/Downloads/unittest2-0.5.1/unittest2/main.py
old
|
new
|
|
4 | 4 | import os |
5 | 5 | import types |
6 | 6 | |
7 | | from django.utils.unittest import loader, runner |
| 7 | from unittest2 import loader, runner |
8 | 8 | try: |
9 | | from django.utils.unittest.signals import installHandler |
| 9 | from unittest2.signals import installHandler |
10 | 10 | except ImportError: |
11 | 11 | installHandler = None |
12 | 12 | |
diff -u -Naur -x .svn -x .DS_Store -x test -x '*.pyc' -w django/utils/unittest/result.py /Users/myk/Downloads/unittest2-0.5.1/unittest2/result.py
old
|
new
|
|
6 | 6 | |
7 | 7 | from StringIO import StringIO |
8 | 8 | |
9 | | from django.utils.unittest import util |
10 | | from django.utils.unittest.compatibility import wraps |
| 9 | from unittest2 import util |
| 10 | from unittest2.compatibility import wraps |
11 | 11 | |
12 | 12 | __unittest = True |
13 | 13 | |
diff -u -Naur -x .svn -x .DS_Store -x test -x '*.pyc' -w django/utils/unittest/runner.py /Users/myk/Downloads/unittest2-0.5.1/unittest2/runner.py
old
|
new
|
|
4 | 4 | import time |
5 | 5 | import unittest |
6 | 6 | |
7 | | from django.utils.unittest import result |
| 7 | from unittest2 import result |
8 | 8 | |
9 | 9 | try: |
10 | | from django.utils.unittest.signals import registerResult |
| 10 | from unittest2.signals import registerResult |
11 | 11 | except ImportError: |
12 | 12 | def registerResult(_): |
13 | 13 | pass |
diff -u -Naur -x .svn -x .DS_Store -x test -x '*.pyc' -w django/utils/unittest/signals.py /Users/myk/Downloads/unittest2-0.5.1/unittest2/signals.py
old
|
new
|
|
1 | 1 | import signal |
2 | 2 | import weakref |
3 | 3 | |
4 | | from django.utils.unittest.compatibility import wraps |
| 4 | from unittest2.compatibility import wraps |
5 | 5 | |
6 | 6 | __unittest = True |
7 | 7 | |
diff -u -Naur -x .svn -x .DS_Store -x test -x '*.pyc' -w django/utils/unittest/suite.py /Users/myk/Downloads/unittest2-0.5.1/unittest2/suite.py
old
|
new
|
|
2 | 2 | |
3 | 3 | import sys |
4 | 4 | import unittest |
5 | | from django.utils.unittest import case, util |
| 5 | from unittest2 import case, util |
6 | 6 | |
7 | 7 | __unittest = True |
8 | 8 | |