Rename for xdist compatibility

Fixes #305
This commit is contained in:
Zac-HD 2020-06-14 18:10:35 +10:00
parent bc92da6149
commit 97f275f47d
3 changed files with 8 additions and 4 deletions

View File

@ -7,6 +7,10 @@ Release Notes
* Thanks to `@p00j4 <https://github.com/p00j4>`_ and `@anothermattbrown <https://github.com/anothermattbrown>`_ for reporting and `@christiansandberg <https://github.com/christiansandberg>`_ and `@superdodd <https://github.com/superdodd>`_ and `@dhalperi <https://github.com/dhalperi>`_ for the fix
* Fix attribute name for compatibility with ``pytest-xdist`` 2. (`#305 <https://github.com/pytest-dev/pytest-html/issues/305>`_)
* Thanks to `@Zac-HD <https://github.com/Zac-HD>`_ for the fix
**2.1.1 (2020-03-18)**
* Fix issue with funcargs causing failures. (`#282 <https://github.com/pytest-dev/pytest-html/issues/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 <https://github.com/The-Compiler>`_)
* Added report sections including stdout and stderr to log

View File

@ -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)

View File

@ -774,7 +774,7 @@ class TestHTML:
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(
"""