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

Method test_itemreport_outcomes

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected