[Python-checkins] cpython (3.2): one more test fix for systems without select.poll. tested by deleting
gregory.p.smith
python-checkins at python.org
Tue Jul 17 00:48:43 CEST 2012
http://hg.python.org/cpython/rev/71537aba3a0a
changeset: 78142:71537aba3a0a
branch: 3.2
parent: 78140:0963dec88636
user: Gregory P. Smith <greg at krypto.org>
date: Mon Jul 16 15:48:30 2012 -0700
summary:
one more test fix for systems without select.poll. tested by deleting
select.poll before running. works both ways (finally). this should fix
the windows build.
files:
Lib/test/test_telnetlib.py | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/Lib/test/test_telnetlib.py b/Lib/test/test_telnetlib.py
--- a/Lib/test/test_telnetlib.py
+++ b/Lib/test/test_telnetlib.py
@@ -169,13 +169,14 @@
def setUp(self):
self.old_select = select.select
select.select = mock_select
+ self.old_poll = False
if hasattr(select, 'poll'):
self.old_poll = select.poll
select.poll = MockPoller
MockPoller.test_case = self
def tearDown(self):
- if hasattr(select, 'poll'):
+ if self.old_poll:
MockPoller.test_case = None
select.poll = self.old_poll
select.select = self.old_select
@@ -210,7 +211,8 @@
"""Use select.select() to implement telnet.read_until()."""
want = [b'x' * 10, b'match', b'y' * 10]
telnet = test_telnet(want, use_poll=False)
- select.poll = lambda *_: self.fail('unexpected poll() call.')
+ if self.old_poll:
+ select.poll = lambda *_: self.fail('unexpected poll() call.')
data = telnet.read_until(b'match')
self.assertEqual(data, b''.join(want[:-1]))
@@ -428,7 +430,8 @@
"""Use select.select() to implement telnet.expect()."""
want = [b'x' * 10, b'match', b'y' * 10]
telnet = test_telnet(want, use_poll=False)
- select.poll = lambda *_: self.fail('unexpected poll() call.')
+ if self.old_poll:
+ select.poll = lambda *_: self.fail('unexpected poll() call.')
(_,_,data) = telnet.expect([b'match'])
self.assertEqual(data, b''.join(want[:-1]))
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list