[Checkins] SVN: zc.buildout/trunk/src/zc/buildout/testing.py Added
flush/fsync to the write method to try to avoid
Jim Fulton
jim at zope.com
Thu Feb 8 12:30:22 EST 2007
Log message for revision 72465:
Added flush/fsync to the write method to try to avoid
spurious test failures. I'm not sure this is really necessary.
Changed:
U zc.buildout/trunk/src/zc/buildout/testing.py
-=-
Modified: zc.buildout/trunk/src/zc/buildout/testing.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/testing.py 2007-02-08 17:30:19 UTC (rev 72464)
+++ zc.buildout/trunk/src/zc/buildout/testing.py 2007-02-08 17:30:21 UTC (rev 72465)
@@ -26,6 +26,8 @@
import zc.buildout.buildout
import zc.buildout.easy_install
+fsync = getattr(os, 'fsync', lambda fileno: None)
+
setuptools_location = pkg_resources.working_set.find(
pkg_resources.Requirement.parse('setuptools')).location
@@ -57,7 +59,12 @@
shutil.rmtree(os.path.join(*path))
def write(dir, *args):
- open(os.path.join(dir, *(args[:-1])), 'w').write(args[-1])
+ path = os.path.join(dir, *(args[:-1]))
+ f = open(path, 'w')
+ f.write(args[-1])
+ f.flush()
+ fsync(f.fileno())
+ f.close()
def system(command, input=''):
i, o = os.popen4(command)
More information about the Checkins
mailing list