summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_compiler.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2006-11-22 04:55:53 (GMT)
committerGuido van Rossum <guido@python.org>2006-11-22 04:55:53 (GMT)
commitf59677a74aeee97a35c5826825170d07a1bb70d9 (patch)
tree5a55b8b73fbe639ec959761398e16751f943cad2 /Lib/test/test_compiler.py
parent29602e42ebdccab99ee8396bba74bd46d5c200b1 (diff)
downloadcpython-f59677a74aeee97a35c5826825170d07a1bb70d9.zip
cpython-f59677a74aeee97a35c5826825170d07a1bb70d9.tar.gz
cpython-f59677a74aeee97a35c5826825170d07a1bb70d9.tar.bz2
The rest of patch 1549670 by Jiwon, making the compiler test pass.
This removes some bogus debug stuff Jiwon accidentally left in last time.
Diffstat (limited to 'Lib/test/test_compiler.py')
-rw-r--r--Lib/test/test_compiler.py75
1 files changed, 30 insertions, 45 deletions
diff --git a/Lib/test/test_compiler.py b/Lib/test/test_compiler.py
index 3027de1..783a34c 100644
--- a/Lib/test/test_compiler.py
+++ b/Lib/test/test_compiler.py
@@ -19,51 +19,36 @@ class CompilerTest(unittest.TestCase):
libdir = os.path.dirname(unittest.__file__)
testdir = os.path.dirname(test.test_support.__file__)
-## for dir in [libdir, testdir]:
-## for basename in os.listdir(dir):
-## # Print still working message since this test can be really slow
-## if next_time <= time.time():
-## next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL
-## print >>sys.__stdout__, \
-## ' testCompileLibrary still working, be patient...'
-## sys.__stdout__.flush()
-##
-## if not basename.endswith(".py"):
-## continue
-## if not TEST_ALL and random() < 0.98:
-## continue
-## path = os.path.join(dir, basename)
-## if test.test_support.verbose:
-## print "compiling", path
-## f = open(path, "U")
-## buf = f.read()
-## f.close()
-## if "badsyntax" in basename or "bad_coding" in basename:
-## self.assertRaises(SyntaxError, compiler.compile,
-## buf, basename, "exec")
-## else:
-## try:
-## compiler.compile(buf, basename, "exec")
-## except Exception, e:
-## args = list(e.args)
-## args[0] += "[in file %s]" % basename
-## e.args = tuple(args)
-## raise
-
- path = "/home/jiwon/p3yk/Lib/test/test_keywordonlyarg.py"
- if test.test_support.verbose:
- print "compiling", path
- f = open(path, "U")
- buf = f.read()
- f.close()
- #try:
- compiler.compile(buf, "test_keywordonlyarg.py", "exec")
- #except Exception, e:
- # args = list(e.args)
- # args[0] += "[in file %s]" % path
- # e.args = tuple(args)
- # raise
-
+ for dir in [libdir, testdir]:
+ for basename in os.listdir(dir):
+ # Print still working message since this test can be really slow
+ if next_time <= time.time():
+ next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL
+ print >>sys.__stdout__, \
+ ' testCompileLibrary still working, be patient...'
+ sys.__stdout__.flush()
+
+ if not basename.endswith(".py"):
+ continue
+ if not TEST_ALL and random() < 0.98:
+ continue
+ path = os.path.join(dir, basename)
+ if test.test_support.verbose:
+ print "compiling", path
+ f = open(path, "U")
+ buf = f.read()
+ f.close()
+ if "badsyntax" in basename or "bad_coding" in basename:
+ self.assertRaises(SyntaxError, compiler.compile,
+ buf, basename, "exec")
+ else:
+ try:
+ compiler.compile(buf, basename, "exec")
+ except Exception, e:
+ args = list(e.args)
+ args[0] += "[in file %s]" % basename
+ e.args = tuple(args)
+ raise
def testNewClassSyntax(self):
compiler.compile("class foo():pass\n\n","<string>","exec")