From 1f736a663d6bd9c7a1a99dc970d70367863810a8 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 22 Nov 2019 05:43:42 +0100 Subject: [PATCH] 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 --- changelog/6254.bugfix.rst | 1 + src/_pytest/terminal.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog/6254.bugfix.rst diff --git a/changelog/6254.bugfix.rst b/changelog/6254.bugfix.rst new file mode 100644 index 000000000..a278a85ed --- /dev/null +++ b/changelog/6254.bugfix.rst @@ -0,0 +1 @@ +Fix compatibility with pytest-parallel (regression in pytest 5.3.0). diff --git a/src/_pytest/terminal.py b/src/_pytest/terminal.py index 40e12e406..e88545eca 100644 --- a/src/_pytest/terminal.py +++ b/src/_pytest/terminal.py @@ -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)