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

Method test_itemreport_outcomes

testing/test_reports.py:152–184  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

150 assert rep_entry.lines == a_entry.lines
151
152 def test_itemreport_outcomes(self, pytester: Pytester) -> None:
153 # This test came originally from test_remote.py in xdist (ca03269).
154 reprec = pytester.inline_runsource(
155 """
156 import pytest
157 def test_pass(): pass
158 def test_fail(): 0/0
159 @pytest.mark.skipif("True")
160 def test_skip(): pass
161 def test_skip_imperative():
162 pytest.skip("hello")
163 @pytest.mark.xfail("True")
164 def test_xfail(): 0/0
165 def test_xfail_imperative():
166 pytest.xfail("hello")
167 """
168 )
169 reports = reprec.getreports("pytest_runtest_logreport")
170 assert len(reports) == 17 # with setup/teardown "passed" reports
171 for rep in reports:
172 d = rep._to_json()
173 newrep = TestReport._from_json(d)
174 assert newrep.passed == rep.passed
175 assert newrep.failed == rep.failed
176 assert newrep.skipped == rep.skipped
177 if newrep.skipped and not hasattr(newrep, "wasxfail"):
178 assert isinstance(newrep.longrepr, tuple)
179 assert len(newrep.longrepr) == 3
180 assert newrep.outcome == rep.outcome
181 assert newrep.when == rep.when
182 assert newrep.keywords == rep.keywords
183 if rep.failed:
184 assert newrep.longreprtext == rep.longreprtext
185
186 def test_collectreport_passed(self, pytester: Pytester) -> None:
187 """This test came originally from test_remote.py in xdist (ca03269)."""

Callers

nothing calls this directly

Calls 4

inline_runsourceMethod · 0.45
getreportsMethod · 0.45
_to_jsonMethod · 0.45
_from_jsonMethod · 0.45

Tested by

no test coverage detected