Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed #20680 -- Deprecated django.utils.unittest.
Refs #19204.
- Loading branch information
Showing
18 changed files
with
81 additions
and
2,883 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,80 +1,9 @@ | |||
""" | import warnings | ||
unittest2 | |||
|
|
||
unittest2 is a backport of the new features added to the unittest testing | warnings.warn("django.utils.unittest will be removed in Django 1.9.", | ||
framework in Python 2.7. It is tested to run on Python 2.4 - 2.6. | PendingDeprecationWarning) | ||
To use unittest2 instead of unittest simply replace ``import unittest`` with | |||
``import unittest2``. | |||
Copyright (c) 1999-2003 Steve Purcell | |||
Copyright (c) 2003-2010 Python Software Foundation | |||
This module is free software, and you may redistribute it and/or modify | |||
it under the same terms as Python itself, so long as this copyright message | |||
and disclaimer are retained in their original form. | |||
IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, | |||
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF | |||
THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH | |||
DAMAGE. | |||
THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT | |||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | |||
PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, | |||
AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | |||
SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | |||
""" | |||
|
|||
import sys | |||
|
|||
# Django hackery to load the appropriate version of unittest | |||
|
|
||
try: | try: | ||
# check the system path first | |||
from unittest2 import * | from unittest2 import * | ||
except ImportError: | except ImportError: | ||
if sys.version_info >= (2,7): | from unittest import * | ||
# unittest2 features are native in Python 2.7 | |||
from unittest import * | |||
else: | |||
# otherwise use our bundled version | |||
__all__ = ['TestResult', 'TestCase', 'TestSuite', | |||
'TextTestRunner', 'TestLoader', 'FunctionTestCase', 'main', | |||
'defaultTestLoader', 'SkipTest', 'skip', 'skipIf', 'skipUnless', | |||
'expectedFailure', 'TextTestResult', '__version__', 'collector'] | |||
|
|||
__version__ = '0.5.1' | |||
|
|||
# Expose obsolete functions for backwards compatibility | |||
__all__.extend(['getTestCaseNames', 'makeSuite', 'findTestCases']) | |||
|
|||
|
|||
from django.utils.unittest.collector import collector | |||
from django.utils.unittest.result import TestResult | |||
from django.utils.unittest.case import \ | |||
TestCase, FunctionTestCase, SkipTest, skip, skipIf,\ | |||
skipUnless, expectedFailure | |||
|
|||
from django.utils.unittest.suite import BaseTestSuite, TestSuite | |||
from django.utils.unittest.loader import \ | |||
TestLoader, defaultTestLoader, makeSuite, getTestCaseNames,\ | |||
findTestCases | |||
|
|||
from django.utils.unittest.main import TestProgram, main, main_ | |||
from django.utils.unittest.runner import TextTestRunner, TextTestResult | |||
|
|||
try: | |||
from django.utils.unittest.signals import\ | |||
installHandler, registerResult, removeResult, removeHandler | |||
except ImportError: | |||
# Compatibility with platforms that don't have the signal module | |||
pass | |||
else: | |||
__all__.extend(['installHandler', 'registerResult', 'removeResult', | |||
'removeHandler']) | |||
|
|||
# deprecated | |||
_TextTestResult = TextTestResult | |||
|
|||
__unittest = True |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.