[Python-checkins] python/dist/src/Lib/test test_compiler.py, NONE, 1.1 regrtest.py, 1.158, 1.159

jhylton at users.sourceforge.net jhylton at users.sourceforge.net
Sat Aug 7 21:25:37 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10095/Lib/test

Modified Files:
	regrtest.py 
Added Files:
	test_compiler.py 
Log Message:
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.


--- NEW FILE: test_compiler.py ---
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()


        

Index: regrtest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v
retrieving revision 1.158
retrieving revision 1.159
diff -C2 -d -r1.158 -r1.159
*** regrtest.py	4 Aug 2004 02:32:03 -0000	1.158
--- regrtest.py	7 Aug 2004 19:25:33 -0000	1.159
***************
*** 84,87 ****
--- 84,91 ----
                  verifies compliance with standards.
  
+     compiler -  Test the compiler package by compiling all the source
+                 in the standard library and test suite.  This takes
+                 a long time.
+ 
  To enable all resources except one, use '-uall,-<resource>'.  For
  example, to run all the tests except for the bsddb tests, give the
***************
*** 127,131 ****
  
  RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network', 'bsddb',
!                   'decimal')
  
  
--- 131,135 ----
  
  RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network', 'bsddb',
!                   'decimal', 'compiler')
  
  



More information about the Python-checkins mailing list