Merge remote-tracking branch 'upstream/master' into ethanhs/silencenodes

This commit is contained in:
Bruno Oliveira
2018-12-11 14:35:25 -02:00
7 changed files with 22 additions and 12 deletions

1
changelog/378.bugfix.rst Normal file
View File

@@ -0,0 +1 @@
Fix support for gevent monkeypatching

1
changelog/384.bugfix.rst Normal file
View File

@@ -0,0 +1 @@
Add support for pytest 4.1.

View File

@@ -541,16 +541,15 @@ def test_session_testscollected(testdir):
assert collected_file.read() == "collected = 3" assert collected_file.read() == "collected = 3"
def test_funcarg_teardown_failure(testdir): def test_fixture_teardown_failure(testdir):
p = testdir.makepyfile( p = testdir.makepyfile(
""" """
import pytest import pytest
@pytest.fixture @pytest.fixture(scope="module")
def myarg(request): def myarg(request):
def teardown(val): yield 42
raise ValueError(val) raise ValueError(42)
return request.cached_setup(setup=lambda: 42, teardown=teardown,
scope="module")
def test_hello(myarg): def test_hello(myarg):
pass pass
""" """
@@ -636,6 +635,11 @@ def test_skipping(testdir):
def test_issue34_pluginloading_in_subprocess(testdir): def test_issue34_pluginloading_in_subprocess(testdir):
import _pytest.hookspec
if not hasattr(_pytest.hookspec, "pytest_namespace"):
pytest.skip("this pytest version no longer supports pytest_namespace()")
testdir.tmpdir.join("plugin123.py").write( testdir.tmpdir.join("plugin123.py").write(
textwrap.dedent( textwrap.dedent(
""" """

View File

@@ -32,7 +32,7 @@ def pytest_cmdline_main(config):
if config.getoption("looponfail"): if config.getoption("looponfail"):
usepdb = config.getoption("usepdb") # a core option usepdb = config.getoption("usepdb") # a core option
if usepdb: if usepdb:
raise pytest.UsageError("--pdb incompatible with --looponfail.") raise pytest.UsageError("--pdb is incompatible with --looponfail.")
looponfail_main(config) looponfail_main(config)
return 2 # looponfail only can get stop with ctrl-C anyway return 2 # looponfail only can get stop with ctrl-C anyway

View File

@@ -126,12 +126,12 @@ def pytest_addoption(parser):
) )
parser.addini( parser.addini(
"rsyncdirs", "rsyncdirs",
"list of (relative) paths to be rsynced for" " remote distributed testing.", "list of (relative) paths to be rsynced for remote distributed testing.",
type="pathlist", type="pathlist",
) )
parser.addini( parser.addini(
"rsyncignore", "rsyncignore",
"list of (relative) glob-style paths to be ignored " "for rsyncing.", "list of (relative) glob-style paths to be ignored for rsyncing.",
type="pathlist", type="pathlist",
) )
parser.addini( parser.addini(

View File

@@ -187,7 +187,7 @@ class LoadScopeScheduling(object):
break break
else: else:
raise RuntimeError( raise RuntimeError(
"Unable to identify crashitem on a workload with " "pending items" "Unable to identify crashitem on a workload with pending items"
) )
# Made uncompleted work unit available again # Made uncompleted work unit available again

View File

@@ -268,7 +268,7 @@ class WorkerController(object):
if not self._down: if not self._down:
try: try:
self.sendcommand("shutdown") self.sendcommand("shutdown")
except IOError: except (IOError, OSError):
pass pass
self._shutdown_sent = True self._shutdown_sent = True
@@ -345,6 +345,10 @@ class WorkerController(object):
except: # noqa except: # noqa
from _pytest._code import ExceptionInfo from _pytest._code import ExceptionInfo
# ExceptionInfo API changed in pytest 4.1
if hasattr(ExceptionInfo, "from_current"):
excinfo = ExceptionInfo.from_current()
else:
excinfo = ExceptionInfo() excinfo = ExceptionInfo()
print("!" * 20, excinfo) print("!" * 20, excinfo)
self.config.notify_exception(excinfo) self.config.notify_exception(excinfo)