diff options
author | Jesus Cea <jcea@jcea.es> | 2011-11-08 15:39:26 (GMT) |
---|---|---|
committer | Jesus Cea <jcea@jcea.es> | 2011-11-08 15:39:26 (GMT) |
commit | 6e533f040b906689ae22eb81eee6863181050aba (patch) | |
tree | e22b243f8a9c80c9842fedac725b8fe9fa220797 /Lib | |
parent | 0fd66b8f303c03fbe5c357e75f088641d82f535b (diff) | |
parent | bc91b469512aec60e26778114442c174b7a146bc (diff) | |
download | cpython-6e533f040b906689ae22eb81eee6863181050aba.zip cpython-6e533f040b906689ae22eb81eee6863181050aba.tar.gz cpython-6e533f040b906689ae22eb81eee6863181050aba.tar.bz2 |
MERGE: Partial patch for issue #11812: Take care of test_telnetlib.py
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_telnetlib.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/test/test_telnetlib.py b/Lib/test/test_telnetlib.py index dd21d5a..e58c10f 100644 --- a/Lib/test/test_telnetlib.py +++ b/Lib/test/test_telnetlib.py @@ -15,10 +15,9 @@ def server(evt, serv): evt.set() try: conn, addr = serv.accept() + conn.close() except socket.timeout: pass - else: - conn.close() finally: serv.close() @@ -27,9 +26,10 @@ class GeneralTests(TestCase): def setUp(self): self.evt = threading.Event() self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.sock.settimeout(3) + self.sock.settimeout(60) # Safety net. Look issue 11812 self.port = support.bind_port(self.sock) self.thread = threading.Thread(target=server, args=(self.evt,self.sock)) + self.thread.setDaemon(True) self.thread.start() self.evt.wait() @@ -46,7 +46,7 @@ class GeneralTests(TestCase): self.assertTrue(socket.getdefaulttimeout() is None) socket.setdefaulttimeout(30) try: - telnet = telnetlib.Telnet("localhost", self.port) + telnet = telnetlib.Telnet(HOST, self.port) finally: socket.setdefaulttimeout(None) self.assertEqual(telnet.sock.gettimeout(), 30) @@ -64,13 +64,13 @@ class GeneralTests(TestCase): telnet.sock.close() def testTimeoutValue(self): - telnet = telnetlib.Telnet("localhost", self.port, timeout=30) + telnet = telnetlib.Telnet(HOST, self.port, timeout=30) self.assertEqual(telnet.sock.gettimeout(), 30) telnet.sock.close() def testTimeoutOpen(self): telnet = telnetlib.Telnet() - telnet.open("localhost", self.port, timeout=30) + telnet.open(HOST, self.port, timeout=30) self.assertEqual(telnet.sock.gettimeout(), 30) telnet.sock.close() |