[py-svn] r32631 - py/dist/py/test/rsession
arigo at codespeak.net
arigo at codespeak.net
Mon Sep 25 15:46:40 CEST 2006
Author: arigo
Date: Mon Sep 25 15:46:38 2006
New Revision: 32631
Modified:
py/dist/py/test/rsession/box.py
py/dist/py/test/rsession/rsync.py
Log:
Merge r32593 and r32594 from the branch (which I didn't realize was
already merged):
box.py - here is where to put os.nice() to run the tests more nicely
on all the client machines.
rsync.py - it seems to be most useful for py.test that rsync doesn't
complain when files change under its feet. Such files
are generally harmless, master-side-only files, e.g.
screenlogs.
Modified: py/dist/py/test/rsession/box.py
==============================================================================
--- py/dist/py/test/rsession/box.py (original)
+++ py/dist/py/test/rsession/box.py Mon Sep 25 15:46:38 2006
@@ -9,6 +9,8 @@
import marshal
import thread
+NICE_LEVEL = 0 # XXX make it a conftest option
+
PYTESTSTDOUT = "pyteststdout"
PYTESTSTDERR = "pyteststderr"
PYTESTRETVAL = "pytestretval"
@@ -80,6 +82,8 @@
sys.stdout = os.fdopen(1, "w", 0)
sys.stderr = os.fdopen(2, "w", 0)
retvalf = open(self.PYTESTRETVAL, "w")
+ if NICE_LEVEL:
+ os.nice(NICE_LEVEL)
retval = self.fun(*self.args, **self.kwargs)
retvalf.write(marshal.dumps(retval))
retvalf.close()
@@ -177,6 +181,8 @@
os.dup2(fdstderr, 2)
retvalf = self.PYTESTRETVAL.open("w")
try:
+ if NICE_LEVEL:
+ os.nice(NICE_LEVEL)
retval = self.fun(*self.args, **self.kwargs)
retvalf.write(marshal.dumps(retval))
finally:
Modified: py/dist/py/test/rsession/rsync.py
==============================================================================
--- py/dist/py/test/rsession/rsync.py (original)
+++ py/dist/py/test/rsession/rsync.py Mon Sep 25 15:46:38 2006
@@ -158,10 +158,14 @@
channel.send((relcomponents, checksum))
modifiedfiles.append((path, msg))
receive_directory_structure(destdir, [])
+
+ STRICT_CHECK = False # seems most useful this way for py.test
+
for path, (time, size) in modifiedfiles:
data = channel.receive()
if data is not None:
- assert len(data) == size
+ if STRICT_CHECK and len(data) != size:
+ raise IOError('file modified during rsync: %r' % (path,))
f = open(path, 'wb')
f.write(data)
f.close()
More information about the pytest-commit
mailing list