diff options
author | Guido van Rossum <guido@python.org> | 1997-01-17 16:13:15 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-01-17 16:13:15 (GMT) |
commit | 1d1394e66068c6a5a391ff4583f9df44bc5a51c2 (patch) | |
tree | 1ce262842c0021efb2d8d9b61fb394381f13165a /Lib | |
parent | ed648a25bdddad8c9796c2d2461979e0ce5c26e8 (diff) | |
download | cpython-1d1394e66068c6a5a391ff4583f9df44bc5a51c2.zip cpython-1d1394e66068c6a5a391ff4583f9df44bc5a51c2.tar.gz cpython-1d1394e66068c6a5a391ff4583f9df44bc5a51c2.tar.bz2 |
Make as sure as we can that the forked child does not return and
continue the tests.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_socket.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index f7b62a9..c27e69f 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -124,17 +124,20 @@ try: conn.close() os._exit(0) else: - # child is client - time.sleep(1) - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - if verbose: - print 'child connecting' - s.connect(hostname, PORT) - msg = 'socket test' - s.send(msg) - data = s.recv(1024) - if msg <> data: - print 'parent/client mismatch' - s.close() + try: + # child is client + time.sleep(1) + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + if verbose: + print 'child connecting' + s.connect(hostname, PORT) + msg = 'socket test' + s.send(msg) + data = s.recv(1024) + if msg <> data: + print 'parent/client mismatch' + s.close() + finally: + os._exit(1) except socket.error: pass |