atelier.test

Defines tools for testing.

  • The make_docs_suite() function to automatically run doctest on each document of a doctree.

  • an extended TestCase with methods to launch a subprocess.

(This module’s source code is available here.)

Functions

interpreter_args()

make_docs_suite(docs_root[, include, …])

Discover the doc files in specified directory docs_root and below and return a test suite which tests them all, each one in a separate subprocess.

Classes

DocTestCase(filename[, addenv])

TestCase([methodName])

A unittest testcase with some additional utility methods.

atelier.test.make_docs_suite(docs_root, include='*.rst', exclude=None, addenv=None)

Discover the doc files in specified directory docs_root and below and return a test suite which tests them all, each one in a separate subprocess.

include is a filename pattern of the files to include. Default is ‘*.rst’.

exclude is an optional filename pattern of the files to exclude. It can be a str with a single pattern or multiple patterns separated by :, or an iterator that yields patterns. If a filename matches any of the patterns, it will be skipped. Default value is None.

addenv is an optional dictionary with additional environment variables to be set in the subprocess. Default is None.

The tests are sorted alphabeticallly in order to avoid surprises when some doctest inadvertantly modifies the database.

class atelier.test.TestCase(methodName='runTest')

Bases: unittest.case.TestCase, rstgen.utils.SubProcessParent

A unittest testcase with some additional utility methods.

project_root

alias of NotImplementedError

run_packages_test(declared_packages)

Checks whether the packages parameter to setup seems correct, i.e. whether all packages in the repository are being published in a source distribution. This is kind of basic hygiene because you usually forget to update this parameter when you add or remove a package.

run_simple_doctests(filenames, **kw)

run doctest of given file in a subprocess

run_unittest(filename, **kw)

run unittest of given file in a subprocess