Remove `terminal.flatten` function in favor of collapse from more_itertools

This commit is contained in:
Bruno Oliveira 2018-03-21 20:20:46 -03:00
parent f61d0525a5
commit 4e717eb626
1 changed files with 2 additions and 10 deletions

View File

@ -12,6 +12,7 @@ import time
import pluggy import pluggy
import py import py
import six import six
from more_itertools import collapse
import pytest import pytest
from _pytest import nodes from _pytest import nodes
@ -442,7 +443,7 @@ class TerminalReporter(object):
def _write_report_lines_from_hooks(self, lines): def _write_report_lines_from_hooks(self, lines):
lines.reverse() lines.reverse()
for line in flatten(lines): for line in collapse(lines):
self.write_line(line) self.write_line(line)
def pytest_report_header(self, config): def pytest_report_header(self, config):
@ -700,15 +701,6 @@ def repr_pythonversion(v=None):
return str(v) return str(v)
def flatten(values):
for x in values:
if isinstance(x, (list, tuple)):
for y in flatten(x):
yield y
else:
yield x
def build_summary_stats_line(stats): def build_summary_stats_line(stats):
keys = ("failed passed skipped deselected " keys = ("failed passed skipped deselected "
"xfailed xpassed warnings error").split() "xfailed xpassed warnings error").split()