示例#1
0
 def test_collectreport_passed(self, testdir):
     """This test came originally from test_remote.py in xdist (ca03269)."""
     reprec = testdir.inline_runsource("def test_func(): pass")
     reports = reprec.getreports("pytest_collectreport")
     for rep in reports:
         d = rep._to_json()
         newrep = CollectReport._from_json(d)
         assert newrep.passed == rep.passed
         assert newrep.failed == rep.failed
         assert newrep.skipped == rep.skipped
示例#2
0
 def test_collectreport_fail(self, testdir):
     """This test came originally from test_remote.py in xdist (ca03269)."""
     reprec = testdir.inline_runsource("qwe abc")
     reports = reprec.getreports("pytest_collectreport")
     assert reports
     for rep in reports:
         d = rep._to_json()
         newrep = CollectReport._from_json(d)
         assert newrep.passed == rep.passed
         assert newrep.failed == rep.failed
         assert newrep.skipped == rep.skipped
         if rep.failed:
             assert newrep.longrepr == str(rep.longrepr)
示例#3
0
 def test_extended_report_deserialization(self, testdir: Testdir) -> None:
     """This test came originally from test_remote.py in xdist (ca03269)."""
     reprec = testdir.inline_runsource("qwe abc")
     reports = reprec.getreports("pytest_collectreport")
     assert reports
     for rep in reports:
         rep.extra = True  # type: ignore[attr-defined]
         d = rep._to_json()
         newrep = CollectReport._from_json(d)
         assert newrep.extra
         assert newrep.passed == rep.passed
         assert newrep.failed == rep.failed
         assert newrep.skipped == rep.skipped
         if rep.failed:
             assert newrep.longrepr == str(rep.longrepr)