From b3466417ea367d9bc7334d9c3b8f3bc5aa218cdb Mon Sep 17 00:00:00 2001 From: Felix Schumacher Date: Fri, 10 Feb 2023 18:28:31 +0100 Subject: [PATCH] Check for old Reporter class after importing it With coverage 7.0.2 a new Reporter class has been introduced, that is incompatible to the one from pre 5.x --- teamcity/pytest_plugin.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/teamcity/pytest_plugin.py b/teamcity/pytest_plugin.py index fe58a88..e2d12f5 100644 --- a/teamcity/pytest_plugin.py +++ b/teamcity/pytest_plugin.py @@ -345,6 +345,8 @@ class _Reporter(object): def __init__(self, coverage, config): try: from coverage.report import Reporter + if not hasattr(Reporter, "find_file_reporters"): + raise ImportError("Wrong Reporter class, probably the Protocol version from coverage >= 7.0.2") except ImportError: # Support for coverage >= 5.0.1. from coverage.report import get_analysis_to_report