Commit 8e59ae90 authored by tarek's avatar tarek

safer test: will not overwrite an existing file for the test

--HG--
branch : distribute
extra : rebase_source : f7eb15a38641127ee2eabdf9aedce9df4e79d581
parent db1f56a5
......@@ -2,6 +2,10 @@ import urllib2
import sys
import os
if os.path.exists('bootstrap.py'):
print 'bootstrap.py exists in the current dir, aborting'
sys.exit(2)
print '**** Starting Test'
print '\n\n'
......@@ -33,20 +37,33 @@ except ImportError:
sys.exit(hasattr(setuptools, "_distribute"))
"""
f = open('script.py', 'w')
f.write(script)
f.close()
root = 'script'
seed = 0
script_name = '%s%d.py' % (root, seed)
args = [sys.executable] + ['script.py']
while os.path.exists(script_name):
seed += 1
script_name = '%s%d.py' % (root, seed)
if is_jython:
res = subprocess.call([sys.executable] + args)
else:
res = os.spawnv(os.P_WAIT, sys.executable, args)
f = open(script_name, 'w')
try:
f.write(script)
finally:
f.close()
print '\n\n'
if res:
print '**** Test is OK'
else:
print '**** Test failed, please send me the output at tarek@ziade.org'
try:
args = [sys.executable] + ['script.py']
if is_jython:
res = subprocess.call([sys.executable] + args)
else:
res = os.spawnv(os.P_WAIT, sys.executable, args)
print '\n\n'
if res:
print '**** Test is OK'
else:
print '**** Test failed, please send me the output at tarek@ziade.org'
finally:
os.remove(script_name)
os.remove('bootstrap.py')
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