summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2008-03-31 04:20:05 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2008-03-31 04:20:05 (GMT)
commitdb4115ffc063f20da2c6078bb93187ee8753d4ec (patch)
treeaefc108acfa75b71a627cb7fa3c0cfd6428a8e07 /Lib
parent9367c78c84efaa3f2d6797ca7e18dc78e838c531 (diff)
downloadcpython-db4115ffc063f20da2c6078bb93187ee8753d4ec.zip
cpython-db4115ffc063f20da2c6078bb93187ee8753d4ec.tar.gz
cpython-db4115ffc063f20da2c6078bb93187ee8753d4ec.tar.bz2
Merged revisions 62039-62042 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r62039 | georg.brandl | 2008-03-29 06:24:23 -0700 (Sat, 29 Mar 2008) | 3 lines Properly check for consistency with the third argument of compile() when compiling an AST node. ........ r62040 | amaury.forgeotdarc | 2008-03-29 06:47:05 -0700 (Sat, 29 Mar 2008) | 5 lines The buildbot "x86 W2k8 trunk" seems to hang in test_socket. http://www.python.org/dev/buildbot/trunk/x86%20W2k8%20trunk/builds/255/step-test/0 Temporarily increase verbosity of this test. ........ r62042 | amaury.forgeotdarc | 2008-03-29 07:53:05 -0700 (Sat, 29 Mar 2008) | 3 lines Still investigating on the hanging test_socket. the test itself doesn't do anything on windows, focus on setUp and tearDown. ........
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_compile.py14
-rw-r--r--Lib/test/test_socket.py14
2 files changed, 28 insertions, 0 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index 376369b..5a069d3 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -427,6 +427,20 @@ if 1:
self.assert_(type(ast) == _ast.Module)
co2 = compile(ast, '%s3' % fname, 'exec')
self.assertEqual(co1, co2)
+ # the code object's filename comes from the second compilation step
+ self.assertEqual(co2.co_filename, '%s3' % fname)
+
+ # raise exception when node type doesn't match with compile mode
+ co1 = compile('print(1)', '<string>', 'exec', _ast.PyCF_ONLY_AST)
+ self.assertRaises(TypeError, compile, co1, '<ast>', 'eval')
+
+ # raise exception when node type is no start node
+ self.assertRaises(TypeError, compile, _ast.If(), '<ast>', 'exec')
+
+ # raise exception when node has invalid children
+ ast = _ast.Module()
+ ast.body = [_ast.BoolOp()]
+ self.assertRaises(TypeError, compile, ast, '<ast>', 'exec')
def test_main():
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 2bec373..f4abffa 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -15,6 +15,14 @@ import array
from weakref import proxy
import signal
+# Temporary hack to see why test_socket hangs on one buildbot
+if os.environ.get('COMPUTERNAME') == "GRAPE":
+ def verbose_write(arg):
+ print(arg, file=sys.__stdout__)
+else:
+ def verbose_write(arg):
+ pass
+
PORT = 50007
HOST = 'localhost'
MSG = b'Michael Gilfix was here\n'
@@ -22,15 +30,21 @@ MSG = b'Michael Gilfix was here\n'
class SocketTCPTest(unittest.TestCase):
def setUp(self):
+ verbose_write(self)
self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+ verbose_write(str(self) + " socket created")
global PORT
PORT = test_support.bind_port(self.serv, HOST, PORT)
+ verbose_write(str(self) + " start listening")
self.serv.listen(1)
+ verbose_write(str(self) + " started")
def tearDown(self):
+ verbose_write(str(self) + " close")
self.serv.close()
self.serv = None
+ verbose_write(str(self) + " done")
class SocketUDPTest(unittest.TestCase):