MCPcopy
hub / github.com/pytest-dev/pytest / assert_outcomes

Function assert_outcomes

src/_pytest/pytester_assertions.py:37–74  ·  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: int | None = None,
    deselected: int | None = None,
)

Source from the content-addressed store, hash-verified

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

Callers 1

assert_outcomesMethod · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…