1 new commit in py:
https://bitbucket.org/hpk42/py/commits/efe89560c45d/
Changeset: efe89560c45d
User: hpk42
Date: 2014-06-11 21:38:42
Summary: modified logic so hat it works on python3, also fixed the test
and the changelog entry.
Affected #: 3 files
diff -r af768db52bd077d1688f27794042cf353e21086a -r
efe89560c45df226b37fd2dd929f5d46b6f5421c CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,8 +1,9 @@
1.4.X
==================================================
-- ForkedFunc now opens unbuffered stdout/stderr FDs
- (helps to see output/err from a dying process)
+- ForkedFunc now has class-level register_on_start/on_exit()
+ methods to allow adding information in the boxed process.
+ Thanks Marc Schlaich.
1.4.20
==================================================
diff -r af768db52bd077d1688f27794042cf353e21086a -r
efe89560c45df226b37fd2dd929f5d46b6f5421c py/_process/forkedfunc.py
--- a/py/_process/forkedfunc.py
+++ b/py/_process/forkedfunc.py
@@ -32,6 +32,8 @@
def _run_callbacks(self, callbacks):
for callback in callbacks:
callback(self)
+ sys.stdout.flush()
+ sys.stderr.flush()
class ForkedFunc(HookMixin):
@@ -61,11 +63,11 @@
def _child(self, nice_level):
# right now we need to call a function, but first we need to
# map all IO that might happen
- sys.stdout = stdout = open(str(self.STDOUT), "wb", 0)
+ sys.stdout = stdout = open(str(self.STDOUT), "w")
fdstdout = stdout.fileno()
if fdstdout != 1:
os.dup2(fdstdout, 1)
- sys.stderr = stderr = open(str(self.STDERR), "wb", 0)
+ sys.stderr = stderr = open(str(self.STDERR), "w")
fdstderr = stderr.fileno()
if fdstderr != 2:
os.dup2(fdstderr, 2)
@@ -81,7 +83,7 @@
self._run_on_exit()
except:
excinfo = py.code.ExceptionInfo()
- stderr.write(excinfo.exconly())
+ stderr.write(str(excinfo._getreprcrash()))
EXITSTATUS = self.EXITSTATUS_EXCEPTION
finally:
stdout.close()
diff -r af768db52bd077d1688f27794042cf353e21086a -r
efe89560c45df226b37fd2dd929f5d46b6f5421c testing/process/test_forkedfunc.py
--- a/testing/process/test_forkedfunc.py
+++ b/testing/process/test_forkedfunc.py
@@ -110,7 +110,9 @@
assert result.signal == 15
-def test_hooks():
+def test_hooks(monkeypatch):
+ monkeypatch.setattr(py.process.ForkedFunc, "_on_exit", [])
+ monkeypatch.setattr(py.process.ForkedFunc, "_on_start", [])
def _boxed():
return 1
Repository URL: https://bitbucket.org/hpk42/py/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
pytest-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pytest-commit