Return a testreport whose dotted import path matches.
(
self,
inamepart: str = "",
names: str | Iterable[str] = (
"pytest_runtest_logreport",
"pytest_collectreport",
),
when: str | None = None,
)
| 352 | return [x.report for x in self.getcalls(names)] |
| 353 | |
| 354 | def matchreport( |
| 355 | self, |
| 356 | inamepart: str = "", |
| 357 | names: str | Iterable[str] = ( |
| 358 | "pytest_runtest_logreport", |
| 359 | "pytest_collectreport", |
| 360 | ), |
| 361 | when: str | None = None, |
| 362 | ) -> CollectReport | TestReport: |
| 363 | """Return a testreport whose dotted import path matches.""" |
| 364 | values = [] |
| 365 | for rep in self.getreports(names=names): |
| 366 | if not when and rep.when != "call" and rep.passed: |
| 367 | # setup/teardown passing reports - let's ignore those |
| 368 | continue |
| 369 | if when and rep.when != when: |
| 370 | continue |
| 371 | if not inamepart or inamepart in rep.nodeid.split("::"): |
| 372 | values.append(rep) |
| 373 | if not values: |
| 374 | raise ValueError( |
| 375 | f"could not find test report matching {inamepart!r}: " |
| 376 | "no test reports at all!" |
| 377 | ) |
| 378 | if len(values) > 1: |
| 379 | raise ValueError( |
| 380 | f"found 2 or more testreports matching {inamepart!r}: {values}" |
| 381 | ) |
| 382 | return values[0] |
| 383 | |
| 384 | @overload |
| 385 | def getfailures( |
no test coverage detected