Commit f9105889 authored by Denis Bilenko's avatar Denis Bilenko

fix test___monkey_patching.py

it no longer depends on specific minor python version
parent 4a28b566
......@@ -9,24 +9,27 @@ TIMEOUT = 120
def TESTRUNNER(tests=None):
directory = '%s.%s' % sys.version_info[:2]
version = '%s.%s.%s' % sys.version_info[:3]
assert os.path.isdir(version), 'Directory %s not found in %s' % (version, os.getcwd())
preferred_version = open(os.path.join(directory, 'version')).read().strip()
if preferred_version != version:
util.log('WARNING: The tests in %s/ are from version %s and your Python is %s', directory, preferred_version, version)
env = os.environ.copy()
env['PYTHONPATH'] = os.getcwd() + ':' + os.environ.get('PYTHONPATH', '')
for filename in glob.glob('%s/@test_*_tmp' % version):
for filename in glob.glob('%s/@test_*_tmp' % directory):
os.unlink(filename)
if not tests:
tests = sorted(glob.glob('%s/test_*.py' % version))
tests = sorted(glob.glob('%s/test_*.py' % directory))
tests = [os.path.basename(x) for x in tests]
options = {'cwd': version, 'env': env}
options = {'cwd': directory, 'env': env}
for filename in tests:
yield version + '/' + filename, [sys.executable, '-u', '-m', 'monkey_test', filename], options
yield version + '/' + filename + '/Event', [sys.executable, '-u', '-m', 'monkey_test', '--Event', filename], options
yield directory + '/' + filename, [sys.executable, '-u', '-m', 'monkey_test', filename], options
yield directory + '/' + filename + '/Event', [sys.executable, '-u', '-m', 'monkey_test', '--Event', filename], options
def main():
......
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