Assert that the specified outcomes appear with the respective numbers (0 means it didn't occur) in the text output from a test run.
(
outcomes: dict[str, int],
passed: int = 0,
skipped: int = 0,
failed: int = 0,
errors: int = 0,
xpassed: int = 0,
xfailed: int = 0,
warnings: int | None = None,
deselected: int | None = None,
)
| 35 | |
| 36 | |
| 37 | def assert_outcomes( |
| 38 | outcomes: dict[str, int], |
| 39 | passed: int = 0, |
| 40 | skipped: int = 0, |
| 41 | failed: int = 0, |
| 42 | errors: int = 0, |
| 43 | xpassed: int = 0, |
| 44 | xfailed: int = 0, |
| 45 | warnings: int | None = None, |
| 46 | deselected: int | None = None, |
| 47 | ) -> None: |
| 48 | """Assert that the specified outcomes appear with the respective |
| 49 | numbers (0 means it didn't occur) in the text output from a test run.""" |
| 50 | __tracebackhide__ = True |
| 51 | |
| 52 | obtained = { |
| 53 | "passed": outcomes.get("passed", 0), |
| 54 | "skipped": outcomes.get("skipped", 0), |
| 55 | "failed": outcomes.get("failed", 0), |
| 56 | "errors": outcomes.get("errors", 0), |
| 57 | "xpassed": outcomes.get("xpassed", 0), |
| 58 | "xfailed": outcomes.get("xfailed", 0), |
| 59 | } |
| 60 | expected = { |
| 61 | "passed": passed, |
| 62 | "skipped": skipped, |
| 63 | "failed": failed, |
| 64 | "errors": errors, |
| 65 | "xpassed": xpassed, |
| 66 | "xfailed": xfailed, |
| 67 | } |
| 68 | if warnings is not None: |
| 69 | obtained["warnings"] = outcomes.get("warnings", 0) |
| 70 | expected["warnings"] = warnings |
| 71 | if deselected is not None: |
| 72 | obtained["deselected"] = outcomes.get("deselected", 0) |
| 73 | expected["deselected"] = deselected |
| 74 | assert obtained == expected |
no test coverage detected
searching dependent graphs…