diff options
author | Ran Benita <ran@unusedvar.com> | 2020-07-30 17:05:32 +0300 |
---|---|---|
committer | Ran Benita <ran@unusedvar.com> | 2020-07-30 20:19:24 +0300 |
commit | 96a48f0c66ebe1ec2305c21390a3f6c059760af5 (patch) | |
tree | 0e52b88bf528bef60e9037807450ef548fed03b9 /src/_pytest/terminal.py | |
parent | 645cbc91fc1db67a36cca5c5be26e889e81cc768 (diff) | |
download | pytest-96a48f0c66ebe1ec2305c21390a3f6c059760af5.tar.gz |
Stop using more-itertools
We barely use it; the couple places that do are not really worth the
extra dependency, I think the code is clearer without it.
Also simplifies one (regular) itertools usage.
Also improves a check and an error message in `pytest.raises`.
Diffstat (limited to 'src/_pytest/terminal.py')
-rw-r--r-- | src/_pytest/terminal.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/_pytest/terminal.py b/src/_pytest/terminal.py index ef9da50f3..cbca9ba46 100644 --- a/src/_pytest/terminal.py +++ b/src/_pytest/terminal.py @@ -25,7 +25,6 @@ from typing import Union import attr import pluggy import py -from more_itertools import collapse import pytest from _pytest import nodes @@ -715,11 +714,14 @@ class TerminalReporter: self._write_report_lines_from_hooks(lines) def _write_report_lines_from_hooks( - self, lines: List[Union[str, List[str]]] + self, lines: Sequence[Union[str, Sequence[str]]] ) -> None: - lines.reverse() - for line in collapse(lines): - self.write_line(line) + for line_or_lines in reversed(lines): + if isinstance(line_or_lines, str): + self.write_line(line_or_lines) + else: + for line in line_or_lines: + self.write_line(line) def pytest_report_header(self, config: Config) -> List[str]: line = "rootdir: %s" % config.rootdir |