def test_package(finalize_linter: PyLinter, file_names: list[str], check: Callable) -> None: finalize_linter.check(file_names) finalize_linter.reporter = cast( # Due to fixture testutils.GenericTestReporter, finalize_linter.reporter) got = finalize_linter.reporter.finalize().strip() assert check(got)
def finalize_linter(linter: PyLinter) -> Iterator[PyLinter]: """Call reporter.finalize() to clean up pending messages if a test finished badly. """ yield linter linter.reporter = cast( # Due to fixture testutils.GenericTestReporter, linter.reporter) linter.reporter.finalize()
def test_descriptor_crash(fname: str, finalize_linter: PyLinter) -> None: finalize_linter.check([join(REGR_DATA, fname)]) finalize_linter.reporter = cast( # Due to fixture testutils.GenericTestReporter, finalize_linter.reporter) finalize_linter.reporter.finalize().strip()