diff options
author | Gregory P. Smith <greg@krypto.org> | 2012-07-16 22:49:19 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2012-07-16 22:49:19 (GMT) |
commit | daa4c6b2e68c8ab0d929d9f00db45819431b4e3d (patch) | |
tree | 9e219520960e0282f01e329f6a069707d39c0841 /Lib/test | |
parent | 49be9ed9765f30aac0d9757f9f809ac9706e5eb8 (diff) | |
parent | 954d46b2ccf2c5800b89bd6c8616cafeb39168d6 (diff) | |
download | cpython-daa4c6b2e68c8ab0d929d9f00db45819431b4e3d.zip cpython-daa4c6b2e68c8ab0d929d9f00db45819431b4e3d.tar.gz cpython-daa4c6b2e68c8ab0d929d9f00db45819431b4e3d.tar.bz2 |
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.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | 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 index c8da421..11e95e7 100644 --- a/Lib/test/test_telnetlib.py +++ b/Lib/test/test_telnetlib.py @@ -170,13 +170,14 @@ class ExpectAndReadTestCase(TestCase): 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 @@ -211,7 +212,8 @@ class ReadTests(ExpectAndReadTestCase): """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])) @@ -429,7 +431,8 @@ class ExpectTests(ExpectAndReadTestCase): """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])) |