[Python-checkins] r86205 - python/branches/py3k/Lib/test/test_socket.py

brian.curtin python-checkins at python.org
Fri Nov 5 16:47:45 CET 2010


Author: brian.curtin
Date: Fri Nov  5 16:47:45 2010
New Revision: 86205

Log:
Add socket cleanup for ResourceWarning and update test to use skip decorator


Modified:
   python/branches/py3k/Lib/test/test_socket.py

Modified: python/branches/py3k/Lib/test/test_socket.py
==============================================================================
--- python/branches/py3k/Lib/test/test_socket.py	(original)
+++ python/branches/py3k/Lib/test/test_socket.py	Fri Nov  5 16:47:45 2010
@@ -592,15 +592,15 @@
         finally:
             sock.close()
 
+    @unittest.skipUnless(os.name == "nt", "Windows specific")
     def test_sock_ioctl(self):
-        if os.name != "nt":
-            return
         self.assertTrue(hasattr(socket.socket, 'ioctl'))
         self.assertTrue(hasattr(socket, 'SIO_RCVALL'))
         self.assertTrue(hasattr(socket, 'RCVALL_ON'))
         self.assertTrue(hasattr(socket, 'RCVALL_OFF'))
         self.assertTrue(hasattr(socket, 'SIO_KEEPALIVE_VALS'))
         s = socket.socket()
+        self.addCleanup(s.close)
         self.assertRaises(ValueError, s.ioctl, -1, None)
         s.ioctl(socket.SIO_KEEPALIVE_VALS, (1, 100, 100))
 


More information about the Python-checkins mailing list