(self)
| 154 | # normal unittest machinery (or Nose, or Trial) can find it. |
| 155 | class Tester(unittest.TestCase): |
| 156 | def test(self): |
| 157 | # Make a new runner per function to be tested |
| 158 | runner = DocTestRunner(verbose=d2u.verbose) |
| 159 | for the_test in d2u.finder.find(func, func.__name__): |
| 160 | runner.run(the_test) |
| 161 | failed = count_failures(runner) |
| 162 | if failed: |
| 163 | # Since we only looked at a single function's docstring, |
| 164 | # failed should contain at most one item. More than that |
| 165 | # is a case we can't handle and should error out on |
| 166 | if len(failed) > 1: |
| 167 | err = "Invalid number of test results: %s" % failed |
| 168 | raise ValueError(err) |
| 169 | # Report a normal failure. |
| 170 | self.fail('failed doctests: %s' % str(failed[0])) |
| 171 | |
| 172 | # Rename it so test reports have the original signature. |
| 173 | Tester.__name__ = func.__name__ |
nothing calls this directly
no test coverage detected