diff options
| author | Jonathan Lange <jml@mumak.net> | 2015-12-10 18:09:25 +0000 |
|---|---|---|
| committer | Jonathan Lange <jml@mumak.net> | 2015-12-10 18:09:25 +0000 |
| commit | e187feb87eda3e595223932ee80d47f2a2d2f15e (patch) | |
| tree | b5c49d3a0c7baa64a7463f064154ec941acf508a /testtools | |
| parent | 6b1765c4d6cb0352662de37a97ae767e8fdf49bc (diff) | |
| download | testtools-e187feb87eda3e595223932ee80d47f2a2d2f15e.tar.gz | |
Document the bits of TestCase that RunTest needs
Diffstat (limited to 'testtools')
| -rw-r--r-- | testtools/_itesttools.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/testtools/_itesttools.py b/testtools/_itesttools.py index f2b206f..adb0541 100644 --- a/testtools/_itesttools.py +++ b/testtools/_itesttools.py @@ -30,3 +30,58 @@ class ITestCase(IRunnable): def shortDescription(self): """Return a short, human-readable description.""" + + +class ITestCaseStrategy(Interface): + """What ``RunTest`` needs to run a test case. + + This is a test that has a ``setUp``, a test body, and a ``tearDown``. + """ + + """Should local variables be captured in tracebacks? + + Can be mutated externally. + """ + __testtools_tb_locals__ = False + + """List of ``(function, args, kwargs)`` called in reverse order after test. + + This list is mutated by ``RunTest``. + """ + _cleanups = [] + + """If non-False, then force the test to fail regardless of behavior. + + If not defined, assumed to be False. + """ + force_failure = False + + def defaultTestResult(): + """Construct a test result object for reporting results.""" + + def _get_test_method(): + """Get the test method we are exercising.""" + + def _run_setup(result): + """Run the ``setUp`` method of the test.""" + + def _run_test_method(result): + """Run the test method. + + Must run the method returned by _get_test_method. + """ + + def _run_teardown(result): + """Run the ``tearDown`` method of the test.""" + + def getDetails(): + """Return a mutable dict mapping names to ``Content``.""" + + def onException(exc_info, tb_label): + """Called when we receive an exception. + + :param exc_info: A tuple of (exception_type, exception_value, + traceback). + :param tb_label: Used as the label for the traceback, if the traceback + is to be attached as a detail. + """ |
