Commit d14f075e authored by Jim Fulton's avatar Jim Fulton

On two of my machines, I got spurious test failures when a test failed

to see that a file removed by a subprocess was actually removed.
Added logic to wait for the file to disappear. :/

Whitespace cleanup. (Although there are a few required trailing white
spaces in buildout.txt.
parent aed2a76a
...@@ -573,6 +573,10 @@ When we rerun the buildout: ...@@ -573,6 +573,10 @@ When we rerun the buildout:
... ...
OSError: [Errno 17] File exists: '/sample-buildout/bin' OSError: [Errno 17] File exists: '/sample-buildout/bin'
.. Wait for the file to really disappear. My linux is weird.
>>> wait_until("foo goes away", lambda : not os.path.exists('foo'))
we get the same error, but we don't get the directory left behind: we get the same error, but we don't get the directory left behind:
>>> os.path.exists('foo') >>> os.path.exists('foo')
......
...@@ -183,6 +183,19 @@ def find_python(version): ...@@ -183,6 +183,19 @@ def find_python(version):
"of the Python %(version)s executable before running the tests." "of the Python %(version)s executable before running the tests."
% {'version': version}) % {'version': version})
def wait_until(label, func, *args, **kw):
if 'timeout' in kw:
kw = dict(kw)
timeout = kw.pop('timeout')
else:
timeout = 30
deadline = time.time()+timeout
while time.time() < deadline:
if func(*args, **kw):
return
time.sleep('.01')
raise ValueError('Timed out waiting for: '+label)
def buildoutSetUp(test): def buildoutSetUp(test):
test.globs['__tear_downs'] = __tear_downs = [] test.globs['__tear_downs'] = __tear_downs = []
...@@ -272,6 +285,7 @@ def buildoutSetUp(test): ...@@ -272,6 +285,7 @@ def buildoutSetUp(test):
bdist_egg = bdist_egg, bdist_egg = bdist_egg,
start_server = start_server, start_server = start_server,
buildout = os.path.join(sample, 'bin', 'buildout'), buildout = os.path.join(sample, 'bin', 'buildout'),
wait_until = wait_until,
)) ))
zc.buildout.easy_install.prefer_final(prefer_final) zc.buildout.easy_install.prefer_final(prefer_final)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment