MCPcopy Create free account
hub / github.com/catboost/catboost / TestItem

Class TestItem

library/python/pytest/plugins/ya.py:677–765  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

675
676
677class TestItem(object):
678
679 def __init__(self, report, location, result, test_suffix, markers=None):
680 self._result = result
681 self.nodeid = report.nodeid
682 self._class_name, self._test_name = tools.split_node_id(self.nodeid, test_suffix)
683 self._error = ""
684 self._status = None
685 self._location = location
686 self._duration = hasattr(report, 'duration') and report.duration or 0
687 self._keywords = getattr(report, "keywords", {})
688 self._xfaildiff = any(m.name == 'xfaildiff' for m in (markers or []))
689 self._process_report(report)
690
691 def _process_report(self, report):
692 if report.longrepr:
693 self.set_error(report)
694 if hasattr(report, 'when') and report.when != "call":
695 self.set_error(report.when + " failed:\n" + self._error)
696
697 report_teststatus = _pytest.skipping.pytest_report_teststatus(report)
698 if report_teststatus is not None:
699 report_teststatus = report_teststatus[0]
700
701 if report_teststatus == 'xfailed':
702 self._status = 'xfail'
703 self.set_error(report.wasxfail or 'test was marked as xfail', 'imp')
704 elif report_teststatus == 'xpassed':
705 self._status = 'xpass'
706 self.set_error("Test unexpectedly passed")
707 elif report.skipped:
708 self._status = 'skipped'
709 self.set_error(yatest_lib.tools.to_utf8(report.longrepr[-1]))
710 elif report.passed:
711 if self._xfaildiff:
712 self._status = 'xfaildiff'
713 else:
714 self._status = 'good'
715 else:
716 self._status = 'fail'
717
718 @property
719 def status(self):
720 return self._status
721
722 def set_status(self, status):
723 self._status = status
724
725 @property
726 def test_name(self):
727 return tools.normalize_name(self._test_name)
728
729 @property
730 def class_name(self):
731 return tools.normalize_name(self._class_name)
732
733 @property
734 def error(self):

Callers 3

pytest_collectreportFunction · 0.85
logreportFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected