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.2.zip (7.9 kB view details)

Uploaded Source

Built Distributions

dutest-0.1.2.win32.exe (71.4 kB view details)

Uploaded Source

dutest-0.1.2-py2.5.egg (13.6 kB view details)

Uploaded Source

File details

Details for the file dutest-0.1.2.zip.

File metadata

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

File hashes

Hashes for dutest-0.1.2.zip
Algorithm Hash digest
SHA256 5dee0cb3324cd6006a1aafb7376023558750c0727aab0877510baf633c1b80d4
MD5 c57a889320f506cdfb5b38a6518458f0
BLAKE2b-256 b4d8dd4dd5964f7cb6bd7308f78e08bcd0f972abf6c817c8b78868a60000e957

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for dutest-0.1.2.win32.exe
Algorithm Hash digest
SHA256 8e95f6176153a7b2a21d04c58b9599a733197a3ce0011498f270149353868831
MD5 c00763b6825bfb0d7cb2c7d3a227d657
BLAKE2b-256 dfc8d2c9792b7d90afa4fe23cc5292053dc895d7aaa230aa32a2978931674362

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for dutest-0.1.2-py2.5.egg
Algorithm Hash digest
SHA256 305bf04557849e84bde8f90db9d8ed85a739cf62209db9b23a0684982a108818
MD5 bb3963cd37452beb2c318d21756ca7d1
BLAKE2b-256 5074d6a2e1cf4305789fbe4509b90ab2aa30eec2bdba9c07c64afe3195cb06c0

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