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

Function assert_outcomes

src/_pytest/pytester_assertions.py:37–74  ·  src/_pytest/pytester_assertions.py::assert_outcomes

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 class="st">"""Assert that the specified outcomes appear with the respective
49 numbers (0 means it didn&class="cm">#x27;t occur) in the text output from a test run.class="st">"""
50 __tracebackhide__ = True
51
52 obtained = {
53 class="st">"passed": outcomes.get(class="st">"passed", 0),
54 class="st">"skipped": outcomes.get(class="st">"skipped", 0),
55 class="st">"failed": outcomes.get(class="st">"failed", 0),
56 class="st">"errors": outcomes.get(class="st">"errors", 0),
57 class="st">"xpassed": outcomes.get(class="st">"xpassed", 0),
58 class="st">"xfailed": outcomes.get(class="st">"xfailed", 0),
59 }
60 expected = {
61 class="st">"passed": passed,
62 class="st">"skipped": skipped,
63 class="st">"failed": failed,
64 class="st">"errors": errors,
65 class="st">"xpassed": xpassed,
66 class="st">"xfailed": xfailed,
67 }
68 if warnings is not None:
69 obtained[class="st">"warnings"] = outcomes.get(class="st">"warnings", 0)
70 expected[class="st">"warnings"] = warnings
71 if deselected is not None:
72 obtained[class="st">"deselected"] = outcomes.get(class="st">"deselected", 0)
73 expected[class="st">"deselected"] = deselected
74 assert obtained == expected

Callers 1

assert_outcomesMethod · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected