[Python-checkins] cpython (3.2): Fix unchecked select.poll reference in setUp and tearDown for

gregory.p.smith python-checkins at python.org
Mon Jul 16 22:39:16 CEST 2012


http://hg.python.org/cpython/rev/0963dec88636
changeset:   78140:0963dec88636
branch:      3.2
parent:      78137:2a14987d50e5
user:        Gregory P. Smith <greg at krypto.org>
date:        Mon Jul 16 13:38:45 2012 -0700
summary:
  Fix unchecked select.poll reference in setUp and tearDown for
platforms that don't have it.

files:
  Lib/test/test_telnetlib.py |  12 +++++++-----
  1 files changed, 7 insertions(+), 5 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
@@ -168,14 +168,16 @@
 class ExpectAndReadTestCase(TestCase):
     def setUp(self):
         self.old_select = select.select
-        self.old_poll = select.poll
         select.select = mock_select
-        select.poll = MockPoller
-        MockPoller.test_case = self
+        if hasattr(select, 'poll'):
+            self.old_poll = select.poll
+            select.poll = MockPoller
+            MockPoller.test_case = self
 
     def tearDown(self):
-        MockPoller.test_case = None
-        select.poll = self.old_poll
+        if hasattr(select, 'poll'):
+            MockPoller.test_case = None
+            select.poll = self.old_poll
         select.select = self.old_select
 
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list