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