Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c68478997 | ||
|
|
0181829ba7 | ||
|
|
9b767a8dcb | ||
|
|
449e6c2e00 | ||
|
|
4dc86a1dad | ||
|
|
c4c4dab53f | ||
|
|
17978f3bea |
@@ -1,3 +1,14 @@
|
||||
pytest-xdist 1.22.0 (2018-01-11)
|
||||
================================
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
- Add support for the ``pytest_runtest_logfinish`` hook which will be released
|
||||
in pytest 3.4. (`#266
|
||||
<https://github.com/pytest-dev/pytest-xdist/issues/266>`_)
|
||||
|
||||
|
||||
pytest-xdist 1.21.0 (2017-12-22)
|
||||
================================
|
||||
|
||||
|
||||
@@ -44,6 +44,9 @@ program source code to the remote place. All test results
|
||||
are reported back and displayed to your local terminal.
|
||||
You may specify different Python versions and interpreters.
|
||||
|
||||
If you would like to know how pytest-xdist works under the covers, checkout
|
||||
`OVERVIEW <https://github.com/pytest-dev/pytest-xdist/blob/master/OVERVIEW.md>`_.
|
||||
|
||||
|
||||
Installation
|
||||
-----------------------
|
||||
|
||||
@@ -375,6 +375,25 @@ class TestTerminalReporting:
|
||||
"*1 passed, 1 warnings*",
|
||||
])
|
||||
|
||||
def test_logfinish_hook(self, testdir):
|
||||
"""Ensure the pytest_runtest_logfinish hook is being properly handled"""
|
||||
from _pytest import hookspec
|
||||
if not hasattr(hookspec, 'pytest_runtest_logfinish'):
|
||||
pytest.skip('test requires pytest_runtest_logfinish hook in pytest (3.4+)')
|
||||
|
||||
testdir.makeconftest("""
|
||||
def pytest_runtest_logfinish():
|
||||
print('pytest_runtest_logfinish hook called')
|
||||
""")
|
||||
testdir.makepyfile("""
|
||||
def test_func():
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest("-n1", "-s")
|
||||
result.stdout.fnmatch_lines([
|
||||
"*pytest_runtest_logfinish hook called*",
|
||||
])
|
||||
|
||||
|
||||
def test_teardownfails_one_function(testdir):
|
||||
p = testdir.makepyfile("""
|
||||
|
||||
@@ -235,6 +235,11 @@ class DSession:
|
||||
self.config.hook.pytest_runtest_logstart(
|
||||
nodeid=nodeid, location=location)
|
||||
|
||||
def slave_logfinish(self, node, nodeid, location):
|
||||
"""Emitted when a node calls the pytest_runtest_logfinish hook."""
|
||||
self.config.hook.pytest_runtest_logfinish(
|
||||
nodeid=nodeid, location=location)
|
||||
|
||||
def slave_testreport(self, node, rep):
|
||||
"""Emitted when a node calls the pytest_runtest_logreport hook."""
|
||||
rep.node = node
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
import sys
|
||||
import os
|
||||
import time
|
||||
|
||||
import _pytest.hookspec
|
||||
import pytest
|
||||
|
||||
|
||||
@@ -93,6 +95,11 @@ class SlaveInteractor:
|
||||
def pytest_runtest_logstart(self, nodeid, location):
|
||||
self.sendevent("logstart", nodeid=nodeid, location=location)
|
||||
|
||||
# the pytest_runtest_logfinish hook was introduced in pytest 3.4
|
||||
if hasattr(_pytest.hookspec, 'pytest_runtest_logfinish'):
|
||||
def pytest_runtest_logfinish(self, nodeid, location):
|
||||
self.sendevent("logfinish", nodeid=nodeid, location=location)
|
||||
|
||||
def pytest_runtest_logreport(self, report):
|
||||
data = serialize_report(report)
|
||||
data["item_index"] = self.item_index
|
||||
|
||||
@@ -304,7 +304,7 @@ class SlaveController(object):
|
||||
self._down = True
|
||||
self.slaveoutput = kwargs['slaveoutput']
|
||||
self.notify_inproc("slavefinished", node=self)
|
||||
elif eventname == "logstart":
|
||||
elif eventname in ("logstart", "logfinish"):
|
||||
self.notify_inproc(eventname, node=self, **kwargs)
|
||||
elif eventname in (
|
||||
"testreport", "collectreport", "teardownreport"):
|
||||
|
||||
Reference in New Issue
Block a user