Skip to main content

An object-oriented API to test doctests using unittest runners.

Project description

An object-oriented API to test doctests using unittest runners.

Module providing classes which extend doctest module so as to achieve better integration with unittest.

It is different from the Pyhton 2.4 doctest unittest API because:

  • A new unitest.TestLoader descendant now allows to load instances of TestCases for doctests using unittest-style, supports building complex test suites in a more natural way, and eases the use of specialized instances of TestCase built out of doctest examples.

  • Other loaders allow users to extract TestCase instances out of TestCase descendants and doctests (and any other format) in a single step.

  • In this case unittest.TestResult instances report whether individual examples have been successfully executed, or otherwise have failed or raised an unexpected exception. Formerly TestResult objects contained the whole report outputted by doctest module.

  • Test analysis require no further parsing to retrieve detailed information about failures.

  • A whole new unittest API for doctest adds object orientation and eliminates functions with big signatures.

  • It is not necessary to use DocTestRunner output streams in order to collect test results.

  • A new hierarchy of doctest TestCases is now possible so for example, setUp and tearDown may be redefined across a hierarchy of TestCases instead of providing this methods as parameters to a function (breaking OOP philosophy and logic); or maybe even failures and errors can be represented in a custom way.

  • Allows to perform regression testing over tests written using doctest.

  • Fixes a minor bug related with specifying different verbosity levels from the command line to unittest.TestProgram (alias main).

  • Loads by default test cases for doctests plus those formerly loaded by unittest.TestLoader

It is similar to the Pyhton 2.4 doctest unittest API because:

  • Provides integration with TestProgram and unittest test runners.

  • Allows to parameterize doctest behavior via doctest options

A fuller explanation can be found in the following article:

  1. Lang “Doctest and unittest… now they’ll live happily together”
    1. The Python Papers, Volume 3, Issue 1, pp. 31:51

Note: The contents of this module were first implemented by the module oop.utils.testing in the PyOOP package.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dutest-0.1.1.zip (7.1 kB view details)

Uploaded Source

Built Distributions

dutest-0.1.1.win32.exe (71.2 kB view details)

Uploaded Source

dutest-0.1.1-py2.5.egg (13.3 kB view details)

Uploaded Source

File details

Details for the file dutest-0.1.1.zip.

File metadata

  • Download URL: dutest-0.1.1.zip
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for dutest-0.1.1.zip
Algorithm Hash digest
SHA256 750782d94d68517fd92917145a16354cb87940cc20ee18cb31592dadf90f9202
MD5 561f813daa2c02ecb96254dbf655426d
BLAKE2b-256 cbdb60861294d5a680979a655f6c9517d1dd01a7e0403c644457d3795615591b

See more details on using hashes here.

File details

Details for the file dutest-0.1.1.win32.exe.

File metadata

  • Download URL: dutest-0.1.1.win32.exe
  • Upload date:
  • Size: 71.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for dutest-0.1.1.win32.exe
Algorithm Hash digest
SHA256 14abeae69c53d62b112af558c880423c9116301e3d17fc1bf685cc446ab9d6e5
MD5 5b780a5c36ad7c4451be58bef9e01e76
BLAKE2b-256 7f385262c358ba253323a41663676d17d562617f7ce55c84193d98df473c6c1e

See more details on using hashes here.

File details

Details for the file dutest-0.1.1-py2.5.egg.

File metadata

  • Download URL: dutest-0.1.1-py2.5.egg
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for dutest-0.1.1-py2.5.egg
Algorithm Hash digest
SHA256 160aa32ac3200a10a6ddbf8dfa5db7be9f13c98886f7d326992863700309d014
MD5 4fa9cac584eedae38cc56a463915bbf7
BLAKE2b-256 4ed6a201700b7db270fc0a8312a3b8281f45d3135ec54f5148bf5dec50dfb8ca

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page