terminal: _get_main_color: help pytest-parallel

Use `dict.keys()` to work around `__iter__` not working with a
multiprocessing DictProxy.

Ref: https://github.com/python/cpython/pull/17333
Fixes https://github.com/pytest-dev/pytest/issues/6254.
Ref: https://github.com/browsertron/pytest-parallel/issues/36
This commit is contained in:
Daniel Hahler 2019-11-22 05:43:42 +01:00
parent 63c9ad02f4
commit 1f736a663d
2 changed files with 2 additions and 1 deletions

View File

@ -0,0 +1 @@
Fix compatibility with pytest-parallel (regression in pytest 5.3.0).

View File

@ -1099,7 +1099,7 @@ def _get_main_color(stats) -> Tuple[str, List[str]]:
"failed passed skipped deselected xfailed xpassed warnings error".split()
)
unknown_type_seen = False
for found_type in stats:
for found_type in stats.keys():
if found_type not in known_types:
if found_type: # setup/teardown reports have an empty key, ignore them
known_types.append(found_type)