(self, testreport: TestReport)
| 112 | return None |
| 113 | |
| 114 | def record_testreport(self, testreport: TestReport) -> None: |
| 115 | names = mangle_test_address(testreport.nodeid) |
| 116 | existing_attrs = self.attrs |
| 117 | classnames = names[:-1] |
| 118 | if self.xml.prefix: |
| 119 | classnames.insert(0, self.xml.prefix) |
| 120 | attrs: dict[str, str] = { |
| 121 | class="st">"classname": class="st">".".join(classnames), |
| 122 | class="st">"name": bin_xml_escape(names[-1]), |
| 123 | class="st">"file": testreport.location[0], |
| 124 | } |
| 125 | if testreport.location[1] is not None: |
| 126 | attrs[class="st">"line"] = str(testreport.location[1]) |
| 127 | if hasattr(testreport, class="st">"url"): |
| 128 | attrs[class="st">"url"] = testreport.url |
| 129 | self.attrs = attrs |
| 130 | self.attrs.update(existing_attrs) class="cm"># Restore any user-defined attributes. |
| 131 | |
| 132 | class="cm"># Preserve legacy testcase behavior. |
| 133 | if self.family == class="st">"xunit1": |
| 134 | return |
| 135 | |
| 136 | class="cm"># Filter out attributes not permitted by this test family. |
| 137 | class="cm"># Including custom attributes because they are not valid here. |
| 138 | temp_attrs = {} |
| 139 | for key in self.attrs: |
| 140 | if key in families[self.family][class="st">"testcase"]: |
| 141 | temp_attrs[key] = self.attrs[key] |
| 142 | self.attrs = temp_attrs |
| 143 | |
| 144 | def to_xml(self) -> ET.Element: |
| 145 | testcase = ET.Element(class="st">"testcase", self.attrs, time=fclass="st">"{self.duration:.3f}") |
no test coverage detected