From fb40056950a0c7e008de03fb83c13ac2dbe52bd8 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 14 Jun 2019 11:18:14 -0300 Subject: [PATCH] Compatibility for IntEnum change in upcoming pytest 5.0 Related to pytest-dev/pytest#5420 --- changelog/442.feature.rst | 1 + src/xdist/remote.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelog/442.feature.rst diff --git a/changelog/442.feature.rst b/changelog/442.feature.rst new file mode 100644 index 00000000..700b012e --- /dev/null +++ b/changelog/442.feature.rst @@ -0,0 +1 @@ +Compatibility fix for upcoming pytest 5.0: ``session.exitstatus`` is now an ``IntEnum`` object. diff --git a/src/xdist/remote.py b/src/xdist/remote.py index d87ff4cf..d06096cb 100644 --- a/src/xdist/remote.py +++ b/src/xdist/remote.py @@ -41,7 +41,8 @@ def pytest_sessionstart(self, session): @pytest.hookimpl(hookwrapper=True) def pytest_sessionfinish(self, exitstatus): - self.config.workeroutput["exitstatus"] = exitstatus + # in pytest 5.0+, exitstatus is an IntEnum object + self.config.workeroutput["exitstatus"] = int(exitstatus) yield self.sendevent("workerfinished", workeroutput=self.config.workeroutput)