unittest2

The new features in unittest for Python 2.7 backported to Python 2.4+.
Download

unittest2 Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Price:
  • FREE
  • Publisher Name:
  • Michael Foord
  • Publisher web site:
  • http://www.voidspace.org.uk/python/rest2web/

unittest2 Tags


unittest2 Description

The new features in unittest for Python 2.7 backported to Python 2.4+. unittest2 is a backport of the new features added to the unittest testing framework in Python 2.7. It is tested to run on Python 2.4 - 2.6.To use unittest2 instead of unittest simply replace import unittest with import unittest2.The classes in unittest2 derive from the equivalent classes in unittest, so it should be possible to use the unittest2 test running infrastructure without having to switch all your tests to using unittest2 immediately. Similarly you can use the new assert methods on unittest2.TestCase with the standard unittest test running infrastructure. Not all of the new features in unittest2 will work with the standard unittest test loaders and runners however.New features include: * addCleanups - better resource management * many new assert methods including better defaults for comparing lists, sets, dicts unicode strings etc and the ability to specify new default methods for comparing specific types * assertRaises as context manager, with access to the exception afterwards * test discovery and new command line options for python -m unittest2 * test skipping and expected failures * load_tests protocol for loading tests from modules or packages * startTestRun and stopTestRun methods on TestResult * various other API improvements and fixes Requirements: · Python What's New in This Release: · assertSameElements removed and assertItemsEqual added; assert that sequences contain the same elements. · Addition of -f/--failfast command line option, stopping test run on first failure or error. · Addition of -c/--catch command line option for better control-C handling during test runs. · Added BaseTestSuite, for use by frameworks that don't want to support shared class and module fixtures. · Skipped test methods no longer have setUp and tearDown called around them. · Faulty load_tests functions no longer halt test discovery. · Using non-strings for failure messages now works. · Potential for UnicodeDecodeError whilst creating failure messages fixed. · Split out monolithic test module into several modules. · BUGFIX: Correct usage message now shown for unit2 scripts. · BUGFIX: __unittest in module globals trims frames from that module in reported stacktraces.


unittest2 Related Software