From 97f275f47dfb2eff27dc22cbcc67f1969384df19 Mon Sep 17 00:00:00 2001 From: Zac-HD Date: Sun, 14 Jun 2020 18:10:35 +1000 Subject: [PATCH] Rename for xdist compatibility Fixes #305 --- CHANGES.rst | 6 +++++- pytest_html/plugin.py | 4 ++-- testing/test_pytest_html.py | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index b2b2cc63..287dd03a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -7,6 +7,10 @@ Release Notes * Thanks to `@p00j4 `_ and `@anothermattbrown `_ for reporting and `@christiansandberg `_ and `@superdodd `_ and `@dhalperi `_ for the fix +* Fix attribute name for compatibility with ``pytest-xdist`` 2. (`#305 `_) + + * Thanks to `@Zac-HD `_ for the fix + **2.1.1 (2020-03-18)** * Fix issue with funcargs causing failures. (`#282 `_) @@ -264,7 +268,7 @@ Release Notes **1.7 (2015-10-19)** -* Fixed INTERNALERROR when an xdist slave crashes +* Fixed INTERNALERROR when an xdist worker crashes (`@The-Compiler `_) * Added report sections including stdout and stderr to log diff --git a/pytest_html/plugin.py b/pytest_html/plugin.py index 45a4f500..b92236a9 100644 --- a/pytest_html/plugin.py +++ b/pytest_html/plugin.py @@ -77,8 +77,8 @@ def pytest_configure(config): for csspath in config.getoption("css"): if not os.path.exists(csspath): raise IOError(f"No such file or directory: '{csspath}'") - if not hasattr(config, "slaveinput"): - # prevent opening htmlpath on slave nodes (xdist) + if not hasattr(config, "workerinput"): + # prevent opening htmlpath on worker nodes (xdist) config._html = HTMLReport(htmlpath, config) config.pluginmanager.register(config._html) diff --git a/testing/test_pytest_html.py b/testing/test_pytest_html.py index c15ce0be..290ffe98 100644 --- a/testing/test_pytest_html.py +++ b/testing/test_pytest_html.py @@ -774,7 +774,7 @@ def pytest_configure(config): assert "Environment" in html assert len(re.findall("ZZZ.+AAA", html, re.DOTALL)) == 1 - def test_xdist_crashing_slave(self, testdir): + def test_xdist_crashing_worker(self, testdir): """https://github.com/pytest-dev/pytest-html/issues/21""" testdir.makepyfile( """