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