25. Development Tools¶
The modules described in this chapter help you write software. For example, the
pydoc module takes a module and generates documentation based on the
module’s contents. The doctest and unittest modules contains
frameworks for writing unit tests that automatically exercise code and verify
that the expected output is produced. 2to3 can translate Python 2.x
source code into valid Python 3.x code.
The list of modules described in this chapter is:
- 25.1.
pydoc— Documentation generator and online help system - 25.2.
doctest— Test interactive Python examples- 25.2.1. Simple Usage: Checking Examples in Docstrings
- 25.2.2. Simple Usage: Checking Examples in a Text File
- 25.2.3. How It Works
- 25.2.4. Basic API
- 25.2.5. Unittest API
- 25.2.6. Advanced API
- 25.2.7. Debugging
- 25.2.8. Soapbox
- 25.3.
unittest— Unit testing framework- 25.3.1. Basic example
- 25.3.2. Command-Line Interface
- 25.3.3. Test Discovery
- 25.3.4. Organizing test code
- 25.3.5. Re-using old test code
- 25.3.6. Skipping tests and expected failures
- 25.3.7. Classes and functions
- 25.3.7.1. Test cases
TestCaseTestCase.setUp()TestCase.tearDown()TestCase.setUpClass()TestCase.tearDownClass()TestCase.run()TestCase.skipTest()TestCase.debug()TestCase.assertEqual()TestCase.assertNotEqual()TestCase.assertTrue()TestCase.assertFalse()TestCase.assertIs()TestCase.assertIsNot()TestCase.assertIsNone()TestCase.assertIsNotNone()TestCase.assertIn()TestCase.assertNotIn()TestCase.assertIsInstance()TestCase.assertNotIsInstance()TestCase.assertRaises()TestCase.assertRaisesRegexp()TestCase.assertAlmostEqual()TestCase.assertNotAlmostEqual()TestCase.assertGreater()TestCase.assertGreaterEqual()TestCase.assertLess()TestCase.assertLessEqual()TestCase.assertRegexpMatches()TestCase.assertNotRegexpMatches()TestCase.assertItemsEqual()TestCase.assertDictContainsSubset()TestCase.addTypeEqualityFunc()TestCase.assertMultiLineEqual()TestCase.assertSequenceEqual()TestCase.assertListEqual()TestCase.assertTupleEqual()TestCase.assertSetEqual()TestCase.assertDictEqual()TestCase.fail()TestCase.failureExceptionTestCase.longMessageTestCase.maxDiffTestCase.countTestCases()TestCase.defaultTestResult()TestCase.id()TestCase.shortDescription()TestCase.addCleanup()TestCase.doCleanups()
FunctionTestCase- 25.3.7.1.1. Deprecated aliases
- 25.3.7.2. Grouping tests
- 25.3.7.3. Loading and running tests
TestLoaderTestResultTestResult.errorsTestResult.failuresTestResult.skippedTestResult.expectedFailuresTestResult.unexpectedSuccessesTestResult.shouldStopTestResult.testsRunTestResult.bufferTestResult.failfastTestResult.wasSuccessful()TestResult.stop()TestResult.startTest()TestResult.stopTest()TestResult.startTestRun()TestResult.stopTestRun()TestResult.addError()TestResult.addFailure()TestResult.addSuccess()TestResult.addSkip()TestResult.addExpectedFailure()TestResult.addUnexpectedSuccess()
TextTestResultdefaultTestLoaderTextTestRunnermain()- 25.3.7.3.1. load_tests Protocol
- 25.3.7.1. Test cases
- 25.3.8. Class and Module Fixtures
- 25.3.9. Signal Handling
- 25.4. 2to3 - Automated Python 2 to 3 code translation
- 25.5.
test— Regression tests package for Python - 25.6.
test.support— Utility functions for testsTestFailedResourceDeniedverbosehave_unicodeis_jythonTESTFNTEST_HTTP_URLforget()is_resource_enabled()requires()findfile()run_unittest()check_warnings()check_py3k_warnings()captured_stdout()import_module()import_fresh_module()TransientResourceEnvironmentVarGuardEnvironmentVarGuard.set()EnvironmentVarGuard.unset()WarningsRecorder
