This page describes the API exposed from the libpry module.
AUTO = object() | Flag object for TestContainer |
def raises(exc, obj, *args, **kwargs)
Assert that a callable raises a specified exception.
class TmpDirMixin()
A utility mixin that creates a temporary directory during setup, and removes it during teardown. The directory path is inserted into the test namespace as follows:
self["tmpdir"] = path
def setUp(self)
def tearDown(self)
class _TestBase(_tinytree.Tree)
Automatically turns methods or arbitrary callables of the form test_* into Tests.
name = None | The name of this node. Names should not contain periods or spaces. |
def __init__(self, children=None, name=None)
def __getitem__(self, key)
Retrieve an item from the tree namespace. Keys are looked up in this node, and on all nodes to the root.
def __setitem__(self, key, value)
Set an item in this node's namespace.
class TestContainer(_TestBase)
A container for tests.
def __init__(self, children=None, name=AUTO)
def setUp(self)
Run before each child is run.
def setUpAll(self)
Run once before any children are run.
def tearDown(self)
Run after each child is run.
def tearDownAll(self)
Run after all children have run.
class AutoTree(TestContainer)
TestContainer that Automatically adds methods of the form test_* as child Tests.
def __init__(self, children=None, name=AUTO)
Optional nested list of subnodes.
The name of this node. Should not contain spaces or periods. If set to the special constant AUTO, the name is computed automatically from the class name of this instance.
Automatically adds methods of the form test_* as child Tests.
class Test(_TestBase)
A node representing a test.
def __init__(self, name)
def __call__(self)
This method contains the actual test.
class CallableNode(Test)
A utility wrapper to create a Test from a callable.
def __init__(self, name, obj)
Copyright Nullcube 2008