Apparently the code to forestall Tk eating events was too aggressive (Tk user input...
[python/dscho.git] / Tools / compiler / regrtest.py
blobfd990a951485f709d66b8d6e29f1e63c4ff5e9b9
1 """Run the Python regression test using the compiler
3 This test runs the standard Python test suite using bytecode generated
4 by this compiler instead of by the builtin compiler.
6 The regression test is run with the interpreter in verbose mode so
7 that import problems can be observed easily.
8 """
10 from compiler import compile
12 import os
13 import sys
14 import test
15 import tempfile
17 def copy_test_suite():
18 dest = tempfile.mktemp()
19 os.mkdir(dest)
20 os.system("cp -r %s/* %s" % (test.__path__[0], dest))
21 print "Creating copy of test suite in", dest
22 return dest
24 def compile_files(dir):
25 print "Compiling",
26 line_len = 10
27 for file in os.listdir(dir):
28 base, ext = os.path.splitext(file)
29 if ext == '.py' and base[:4] == 'test':
30 source = os.path.join(dir, file)
31 line_len = line_len + len(file) + 1
32 if line_len > 75:
33 print "\n\t",
34 line_len = len(source) + 9
35 print file,
36 compile(source)
37 # make sure the .pyc file is not over-written
38 os.chmod(source + "c", 444)
39 print
41 def run_regrtest(test_dir):
42 os.chdir(test_dir)
43 os.system("%s -v regrtest.py" % sys.executable)
45 def cleanup(dir):
46 os.system("rm -rf %s" % dir)
48 def main():
49 test_dir = copy_test_suite()
50 compile_files(test_dir)
51 run_regrtest(test_dir)
52 cleanup(test_dir)
54 if __name__ == "__main__":
55 main()