typing for test_summary_stats

This commit is contained in:
Daniel Hahler 2020-01-25 14:49:48 +01:00
parent 57512aa997
commit 1e3bc1814d
1 changed files with 11 additions and 3 deletions

View File

@ -7,6 +7,9 @@ import re
import sys import sys
import textwrap import textwrap
from io import StringIO from io import StringIO
from typing import Dict
from typing import List
from typing import Tuple
import pluggy import pluggy
import py import py
@ -1345,7 +1348,7 @@ def test_terminal_summary_warnings_header_once(testdir):
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def tr(): def tr() -> TerminalReporter:
config = _pytest.config._prepareconfig() config = _pytest.config._prepareconfig()
return TerminalReporter(config) return TerminalReporter(config)
@ -1480,14 +1483,19 @@ def tr():
), ),
], ],
) )
def test_summary_stats(tr, exp_line, exp_color, stats_arg): def test_summary_stats(
tr: TerminalReporter,
exp_line: List[Tuple[str, Dict[str, bool]]],
exp_color: str,
stats_arg: Dict[str, List],
) -> None:
tr.stats = stats_arg tr.stats = stats_arg
# Fake "_is_last_item" to be True. # Fake "_is_last_item" to be True.
class fake_session: class fake_session:
testscollected = 0 testscollected = 0
tr._session = fake_session tr._session = fake_session # type: ignore[assignment] # noqa: F821
assert tr._is_last_item assert tr._is_last_item
# Reset cache. # Reset cache.