| 10 | |
| 11 | @dataclasses.dataclass(slots=True) |
| 12 | class TestStats: |
| 13 | tests_run: int = 0 |
| 14 | failures: int = 0 |
| 15 | skipped: int = 0 |
| 16 | |
| 17 | @staticmethod |
| 18 | def from_unittest(result): |
| 19 | return TestStats(result.testsRun, |
| 20 | len(result.failures), |
| 21 | len(result.skipped)) |
| 22 | |
| 23 | @staticmethod |
| 24 | def from_doctest(results): |
| 25 | return TestStats(results.attempted, |
| 26 | results.failed, |
| 27 | results.skipped) |
| 28 | |
| 29 | def accumulate(self, stats): |
| 30 | self.tests_run += stats.tests_run |
| 31 | self.failures += stats.failures |
| 32 | self.skipped += stats.skipped |
| 33 | |
| 34 | |
| 35 | # Avoid enum.Enum to reduce the number of imports when tests are run |
no outgoing calls
searching dependent graphs…