]> granicus.if.org Git - python/commitdiff
Add socket cleanup for ResourceWarning and update test to use skip decorator
authorBrian Curtin <brian.curtin@gmail.com>
Fri, 5 Nov 2010 15:47:45 +0000 (15:47 +0000)
committerBrian Curtin <brian.curtin@gmail.com>
Fri, 5 Nov 2010 15:47:45 +0000 (15:47 +0000)
Lib/test/test_socket.py

index facb0651e5784a26108eba11473af93d18e56c2f..57395b09d02b0786dfdf1359da6936bd777ed76a 100644 (file)
@@ -592,15 +592,15 @@ class GeneralModuleTests(unittest.TestCase):
         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))