[Pytest-commit] commit/pytest-xdist: hpk42: fix pytest/xdist issue485 (also depends on py-1.4.21.dev1):
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Wed Mar 26 18:33:31 CET 2014
1 new commit in pytest-xdist:
https://bitbucket.org/hpk42/pytest-xdist/commits/81566ffbb271/
Changeset: 81566ffbb271
User: hpk42
Date: 2014-03-26 18:33:09
Summary: fix pytest/xdist issue485 (also depends on py-1.4.21.dev1):
attach stdout/stderr on --boxed processes that die.
Affected #: 5 files
diff -r b47ddaa7cc6ceb0345895db32f65861d450982f9 -r 81566ffbb2715bdd28499c808fd76e3315489908 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,9 @@
+XXX
+-------------------------
+
+- fix pytest/xdist issue485 (also depends on py-1.4.21.dev1):
+ attach stdout/stderr on --boxed processes that die.
+
1.10
-------------------------
diff -r b47ddaa7cc6ceb0345895db32f65861d450982f9 -r 81566ffbb2715bdd28499c808fd76e3315489908 setup.py
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@
setup(
name="pytest-xdist",
- version='1.10',
+ version='1.11.dev1',
description='py.test xdist plugin for distributed testing and loop-on-failing modes',
long_description=open('README.txt').read(),
license='MIT',
diff -r b47ddaa7cc6ceb0345895db32f65861d450982f9 -r 81566ffbb2715bdd28499c808fd76e3315489908 testing/test_boxed.py
--- a/testing/test_boxed.py
+++ b/testing/test_boxed.py
@@ -1,6 +1,10 @@
-import py
+import pytest
+import os
- at py.test.mark.skipif("not hasattr(os, 'fork')")
+needsfork = pytest.mark.skipif(not hasattr(os, "fork"),
+ reason="os.fork required")
+
+ at needsfork
def test_functional_boxed(testdir):
p1 = testdir.makepyfile("""
import os
@@ -13,12 +17,32 @@
"*1 failed*"
])
+ at needsfork
+def test_functional_boxed_stdout(testdir):
+ p1 = testdir.makepyfile("""
+ import os
+ import sys
+ def test_function():
+ sys.stdout.write("hello\\n")
+ sys.stderr.write("world\\n")
+ os.kill(os.getpid(), 15)
+ """)
+ result = testdir.runpytest(p1, "--boxed")
+ result.stdout.fnmatch_lines("""
+ *CRASHED*
+ *stdout*
+ hello
+ *stderr*
+ world
+ *1 failed*
+ """)
+
class TestOptionEffects:
def test_boxed_option_default(self, testdir):
tmpdir = testdir.tmpdir.ensure("subdir", dir=1)
config = testdir.parseconfig()
assert not config.option.boxed
- py.test.importorskip("execnet")
+ pytest.importorskip("execnet")
config = testdir.parseconfig('-d', tmpdir)
assert not config.option.boxed
diff -r b47ddaa7cc6ceb0345895db32f65861d450982f9 -r 81566ffbb2715bdd28499c808fd76e3315489908 xdist/__init__.py
--- a/xdist/__init__.py
+++ b/xdist/__init__.py
@@ -1,2 +1,2 @@
#
-__version__ = '1.10'
+__version__ = '1.11.dev1'
diff -r b47ddaa7cc6ceb0345895db32f65861d450982f9 -r 81566ffbb2715bdd28499c808fd76e3315489908 xdist/plugin.py
--- a/xdist/plugin.py
+++ b/xdist/plugin.py
@@ -118,10 +118,14 @@
def report_process_crash(item, result):
path, lineno = item._getfslineno()
- info = "%s:%s: running the test CRASHED with signal %d" %(
- path, lineno, result.signal)
+ info = ("%s:%s: running the test CRASHED with signal %d" %
+ (path, lineno, result.signal))
from _pytest import runner
call = runner.CallInfo(lambda: 0/0, "???")
call.excinfo = info
rep = runner.pytest_runtest_makereport(item, call)
+ if result.out:
+ rep.sections.append(("captured stdout", result.out))
+ if result.err:
+ rep.sections.append(("captured stderr", result.err))
return rep
Repository URL: https://bitbucket.org/hpk42/pytest-xdist/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the pytest-commit
mailing list