diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2004-08-07 19:25:33 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2004-08-07 19:25:33 (GMT) |
commit | 4336eda88640695b23790e4f52de9ee92c7fee73 (patch) | |
tree | 6ca34a9bac7f93e0bdc2870fd82293a6ee67d79f /Lib/test/test_compiler.py | |
parent | 32dbddafd52f23622b5a49afd6f9c679f783be0d (diff) | |
download | cpython-4336eda88640695b23790e4f52de9ee92c7fee73.zip cpython-4336eda88640695b23790e4f52de9ee92c7fee73.tar.gz cpython-4336eda88640695b23790e4f52de9ee92c7fee73.tar.bz2 |
Add a trivial test for the compiler package, guarded by compiler resource.
This test is insanely slow, so it requires a resource. On my machine,
it also appears to dump core. I think the problem is a stack
overflow, but haven't been able to confirm.
Diffstat (limited to 'Lib/test/test_compiler.py')
-rw-r--r-- | Lib/test/test_compiler.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Lib/test/test_compiler.py b/Lib/test/test_compiler.py new file mode 100644 index 0000000..fea6856 --- /dev/null +++ b/Lib/test/test_compiler.py @@ -0,0 +1,34 @@ +import compiler +import os +import test.test_support +import unittest + +class CompilerTest(unittest.TestCase): + + def testCompileLibrary(self): + # A simple but large test. Compile all the code in the + # standard library and its test suite. This doesn't verify + # that any of the code is correct, merely the compiler is able + # to generate some kind of code for it. + + libdir = os.path.dirname(unittest.__file__) + testdir = os.path.dirname(test.test_support.__file__) + + for dir in [libdir, testdir]: + for path in os.listdir(dir): + if not path.endswith(".py"): + continue + f = open(os.path.join(dir, path), "r") + buf = f.read() + f.close() + compiler.compile(buf, path, "exec") + +def test_main(): + test.test_support.requires("compiler") + test.test_support.run_unittest(CompilerTest) + +if __name__ == "__main__": + test_main() + + + |