175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen""" 275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenunittest2 375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen 475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenunittest2 is a backport of the new features added to the unittest testing 575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenframework in Python 2.7. It is tested to run on Python 2.4 - 2.6. 675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen 775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny ChenTo use unittest2 instead of unittest simply replace ``import unittest`` with 875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen``import unittest2``. 975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen 1075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen 1175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny ChenCopyright (c) 1999-2003 Steve Purcell 1275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny ChenCopyright (c) 2003-2010 Python Software Foundation 1375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny ChenThis module is free software, and you may redistribute it and/or modify 1475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenit under the same terms as Python itself, so long as this copyright message 1575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenand disclaimer are retained in their original form. 1675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen 1775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny ChenIN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, 1875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny ChenSPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF 1975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny ChenTHIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 2075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny ChenDAMAGE. 2175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen 2275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny ChenTHE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT 2375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny ChenLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 2475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny ChenPARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, 2575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny ChenAND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, 2675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny ChenSUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 2775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen""" 2875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen 2975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen__all__ = ['TestResult', 'TestCase', 'TestSuite', 3075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen 'TextTestRunner', 'TestLoader', 'FunctionTestCase', 'main', 3175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen 'defaultTestLoader', 'SkipTest', 'skip', 'skipIf', 'skipUnless', 3275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen 'expectedFailure', 'TextTestResult', '__version__', 'collector'] 3375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen 3475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen__version__ = '0.5.1' 3575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen 3675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen# Expose obsolete functions for backwards compatibility 3775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen__all__.extend(['getTestCaseNames', 'makeSuite', 'findTestCases']) 3875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen 3975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen 4075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenfrom unittest2.collector import collector 4175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenfrom unittest2.result import TestResult 4275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenfrom unittest2.case import ( 4375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen TestCase, FunctionTestCase, SkipTest, skip, skipIf, 4475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen skipUnless, expectedFailure 4575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen) 4675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenfrom unittest2.suite import BaseTestSuite, TestSuite 4775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenfrom unittest2.loader import ( 4875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen TestLoader, defaultTestLoader, makeSuite, getTestCaseNames, 4975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen findTestCases 5075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen) 5175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenfrom unittest2.main import TestProgram, main, main_ 5275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenfrom unittest2.runner import TextTestRunner, TextTestResult 5375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen 5475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chentry: 5575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen from unittest2.signals import ( 5675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen installHandler, registerResult, removeResult, removeHandler 5775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen ) 5875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenexcept ImportError: 5975e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen # Compatibility with platforms that don't have the signal module 6075e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen pass 6175e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chenelse: 6275e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen __all__.extend(['installHandler', 'registerResult', 'removeResult', 6375e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen 'removeHandler']) 6475e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen 6575e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen# deprecated 6675e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen_TextTestResult = TextTestResult 6775e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen 6875e28f942c1b9f9c6d5a0d5f2efd037cbbc9fc74Johnny Chen__unittest = True