MCPcopy Create free account
hub / github.com/pytest-dev/pytest / assert_outcomes

Function assert_outcomes

src/_pytest/pytester_assertions.py:38–75  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

36
37
38def 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

Callers 1

assert_outcomesMethod · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected