| 
16 | 16 | import sys  | 
17 | 17 | import time  | 
18 | 18 | from configparser import ConfigParser  # type: ignore  | 
19 |  | -from typing import Any, Dict, Generator, List, Optional, Sequence, Tuple, Union  | 
 | 19 | +from typing import Any, Dict, Generator, List, Optional, Sequence, TextIO, Tuple, Union  | 
20 | 20 | 
 
  | 
21 | 21 | import pytest  | 
 | 22 | +from _pytest.config import Config  | 
22 | 23 | from _pytest.config.argparsing import Parser  | 
23 | 24 | from _pytest.main import Session  | 
24 | 25 | from _pytest.nodes import Item  | 
@@ -206,7 +207,7 @@ def pytest_configure(config) -> None:  | 
206 | 207 |     if IS_SUGAR_ENABLED and not getattr(config, "slaveinput", None):  | 
207 | 208 |         # Get the standard terminal reporter plugin and replace it with our  | 
208 | 209 |         standard_reporter = config.pluginmanager.getplugin("terminalreporter")  | 
209 |  | -        sugar_reporter = SugarTerminalReporter(standard_reporter)  | 
 | 210 | +        sugar_reporter = SugarTerminalReporter(standard_reporter.config)  | 
210 | 211 |         config.pluginmanager.unregister(standard_reporter)  | 
211 | 212 |         config.pluginmanager.register(sugar_reporter, "terminalreporter")  | 
212 | 213 | 
 
  | 
@@ -245,9 +246,9 @@ def pytest_report_teststatus(report: BaseReport) -> Optional[Tuple[str, str, str  | 
245 | 246 |     return report.outcome, letter, report.outcome.upper()  | 
246 | 247 | 
 
  | 
247 | 248 | 
 
  | 
248 |  | -class SugarTerminalReporter(TerminalReporter):  # type: ignore  | 
249 |  | -    def __init__(self, reporter) -> None:  | 
250 |  | -        TerminalReporter.__init__(self, reporter.config)  | 
 | 249 | +class SugarTerminalReporter(TerminalReporter):  | 
 | 250 | +    def __init__(self, config: Config, file: Union[TextIO, None] = None) -> None:  | 
 | 251 | +        TerminalReporter.__init__(self, config, file)  | 
251 | 252 |         self.paths_left = []  | 
252 | 253 |         self.tests_count = 0  | 
253 | 254 |         self.tests_taken = 0  | 
 | 
0 commit comments