Ticket #15828: unittest-django-vs-unittest-0.5.1.diff

File unittest-django-vs-unittest-0.5.1.diff, 9.3 KB (added by aaugustin, 4 years ago)
  • __init__.py

    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  
    2626SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
    2727"""
    2828
    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
    4229        __all__ = ['TestResult', 'TestCase', 'TestSuite',
    4330                   'TextTestRunner', 'TestLoader', 'FunctionTestCase', 'main',
    4431                   'defaultTestLoader', 'SkipTest', 'skip', 'skipIf', 'skipUnless',
     
    5037        __all__.extend(['getTestCaseNames', 'makeSuite', 'findTestCases'])
    5138
    5239
    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,\
     40from unittest2.collector import collector
     41from unittest2.result import TestResult
     42from unittest2.case import (
     43    TestCase, FunctionTestCase, SkipTest, skip, skipIf,
    5744            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)
     46from unittest2.suite import BaseTestSuite, TestSuite
     47from unittest2.loader import (
     48    TestLoader, defaultTestLoader, makeSuite, getTestCaseNames,
    6249            findTestCases
    63 
    64         from django.utils.unittest.main import TestProgram, main, main_
    65         from django.utils.unittest.runner import TextTestRunner, TextTestResult
     50)
     51from unittest2.main import TestProgram, main, main_
     52from unittest2.runner import TextTestRunner, TextTestResult
    6653
    6754        try:
    68             from django.utils.unittest.signals import\
     55    from unittest2.signals import (
    6956                installHandler, registerResult, removeResult, removeHandler
     57    )
    7058        except ImportError:
    7159            # Compatibility with platforms that don't have the signal module
    7260            pass
  • __main__.py

    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  
    66
    77__unittest = True
    88
    9 from django.utils.unittest.main import main_
     9from unittest2.main import main_
    1010main_()
  • case.py

    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  
    77import unittest
    88import warnings
    99
    10 from django.utils.unittest import result
    11 from django.utils.unittest.util import\
    12     safe_repr, safe_str, strclass,\
     10from unittest2 import result
     11from unittest2.util import (
     12    safe_repr, safe_str, strclass,
    1313    unorderable_list_difference
     14)
    1415
    15 from django.utils.unittest.compatibility import wraps
     16from unittest2.compatibility import wraps
    1617
    1718__unittest = True
    1819
     
    479480            excName = excClass.__name__
    480481        else:
    481482            excName = str(excClass)
    482         raise self.failureException("%s not raised" % excName)
     483        raise self.failureException, "%s not raised" % excName
    483484
    484485    def _getAssertEqualityFunc(self, first, second):
    485486        """Get a detailed comparison function for the types of the two args.
     
    831832            self.fail(self._formatMessage(msg, standardMsg))
    832833
    833834    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')
    836837
    837838        if d1 != d2:
    838839            standardMsg = '%s != %s' % (safe_repr(d1, True), safe_repr(d2, True))
     
    909910
    910911    def assertMultiLineEqual(self, first, second, msg=None):
    911912        """Assert that two multi-line strings are equal."""
    912         self.assertTrue(isinstance(first, basestring), (
     913        self.assert_(isinstance(first, basestring), (
    913914                'First argument is not a string'))
    914         self.assertTrue(isinstance(second, basestring), (
     915        self.assert_(isinstance(second, basestring), (
    915916                'Second argument is not a string'))
    916917
    917918        if first != second:
     
    997998                excName = expected_exception.__name__
    998999            else:
    9991000                excName = str(expected_exception)
    1000             raise self.failureException("%s not raised" % excName)
     1001            raise self.failureException, "%s not raised" % excName
     1002
    10011003
    10021004    def assertRegexpMatches(self, text, expected_regexp, msg=None):
    10031005        """Fail the test unless the text matches the regular expression."""
  • collector.py

    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  
    11import os
    22import sys
    3 from django.utils.unittest.loader import defaultTestLoader
     3from unittest2.loader import defaultTestLoader
    44
    55def collector():
    66    # import __main__ triggers code re-execution
  • loader.py

    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  
    99
    1010from fnmatch import fnmatch
    1111
    12 from django.utils.unittest import case, suite
     12from unittest2 import case, suite
    1313
    1414try:
    1515    from os.path import relpath
    1616except ImportError:
    17     from django.utils.unittest.compatibility import relpath
     17    from unittest2.compatibility import relpath
    1818
    1919__unittest = True
    2020
  • main.py

    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  
    44import os
    55import types
    66
    7 from django.utils.unittest import loader, runner
     7from unittest2 import loader, runner
    88try:
    9     from django.utils.unittest.signals import installHandler
     9    from unittest2.signals import installHandler
    1010except ImportError:
    1111    installHandler = None
    1212
  • result.py

    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  
    66
    77from StringIO import StringIO
    88
    9 from django.utils.unittest import util
    10 from django.utils.unittest.compatibility import wraps
     9from unittest2 import util
     10from unittest2.compatibility import wraps
    1111
    1212__unittest = True
    1313
  • runner.py

    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  
    44import time
    55import unittest
    66
    7 from django.utils.unittest import result
     7from unittest2 import result
    88
    99try:
    10     from django.utils.unittest.signals import registerResult
     10    from unittest2.signals import registerResult
    1111except ImportError:
    1212    def registerResult(_):
    1313        pass
  • signals.py

    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  
    11import signal
    22import weakref
    33
    4 from django.utils.unittest.compatibility import wraps
     4from unittest2.compatibility import wraps
    55
    66__unittest = True
    77
  • suite.py

    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  
    22
    33import sys
    44import unittest
    5 from django.utils.unittest import case, util
     5from unittest2 import case, util
    66
    77__unittest = True
    88
Back to Top