Johnny Chen | 7325883 | 2010-08-05 23:42:46 +0000 | [diff] [blame] | 1 | """ |
| 2 | unittest2 |
| 3 | |
| 4 | unittest2 is a backport of the new features added to the unittest testing |
| 5 | framework in Python 2.7. It is tested to run on Python 2.4 - 2.6. |
| 6 | |
| 7 | To use unittest2 instead of unittest simply replace ``import unittest`` with |
| 8 | ``import unittest2``. |
| 9 | |
| 10 | |
| 11 | Copyright (c) 1999-2003 Steve Purcell |
| 12 | Copyright (c) 2003-2010 Python Software Foundation |
| 13 | This module is free software, and you may redistribute it and/or modify |
| 14 | it under the same terms as Python itself, so long as this copyright message |
| 15 | and disclaimer are retained in their original form. |
| 16 | |
| 17 | IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, |
| 18 | SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF |
| 19 | THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
| 20 | DAMAGE. |
| 21 | |
| 22 | THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT |
| 23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
| 24 | PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, |
| 25 | AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 26 | SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 27 | """ |
| 28 | |
| 29 | __all__ = ['TestResult', 'TestCase', 'TestSuite', |
| 30 | 'TextTestRunner', 'TestLoader', 'FunctionTestCase', 'main', |
| 31 | 'defaultTestLoader', 'SkipTest', 'skip', 'skipIf', 'skipUnless', |
| 32 | 'expectedFailure', 'TextTestResult', '__version__', 'collector'] |
| 33 | |
| 34 | __version__ = '0.5.1' |
| 35 | |
| 36 | # Expose obsolete functions for backwards compatibility |
| 37 | __all__.extend(['getTestCaseNames', 'makeSuite', 'findTestCases']) |
| 38 | |
| 39 | |
| 40 | from unittest2.collector import collector |
| 41 | from unittest2.result import TestResult |
| 42 | from unittest2.case import ( |
| 43 | TestCase, FunctionTestCase, SkipTest, skip, skipIf, |
| 44 | skipUnless, expectedFailure |
| 45 | ) |
| 46 | from unittest2.suite import BaseTestSuite, TestSuite |
| 47 | from unittest2.loader import ( |
| 48 | TestLoader, defaultTestLoader, makeSuite, getTestCaseNames, |
| 49 | findTestCases |
| 50 | ) |
| 51 | from unittest2.main import TestProgram, main, main_ |
| 52 | from unittest2.runner import TextTestRunner, TextTestResult |
| 53 | |
| 54 | try: |
| 55 | from unittest2.signals import ( |
| 56 | installHandler, registerResult, removeResult, removeHandler |
| 57 | ) |
| 58 | except ImportError: |
| 59 | # Compatibility with platforms that don't have the signal module |
| 60 | pass |
| 61 | else: |
| 62 | __all__.extend(['installHandler', 'registerResult', 'removeResult', |
| 63 | 'removeHandler']) |
| 64 | |
| 65 | # deprecated |
| 66 | _TextTestResult = TextTestResult |
| 67 | |
| 68 | __unittest = True |