diff options
author | Jesus Cea <jcea@jcea.es> | 2011-11-08 15:24:43 (GMT) |
---|---|---|
committer | Jesus Cea <jcea@jcea.es> | 2011-11-08 15:24:43 (GMT) |
commit | bc91b469512aec60e26778114442c174b7a146bc (patch) | |
tree | 557c03cb2c256dee730f70f46d3ffe7aa6ee12a1 /Lib/test/test_telnetlib.py | |
parent | c241df814f614e5e702d2517caf9c0e811a6ca1a (diff) | |
download | cpython-bc91b469512aec60e26778114442c174b7a146bc.zip cpython-bc91b469512aec60e26778114442c174b7a146bc.tar.gz cpython-bc91b469512aec60e26778114442c174b7a146bc.tar.bz2 |
Partial patch for issue #11812: Take care of test_telnetlib.py
Diffstat (limited to 'Lib/test/test_telnetlib.py')
-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 0f0b2ac..87418f5 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() @@ -45,7 +45,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) @@ -63,13 +63,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() |