|
@@ -1201,6 +1201,7 @@ class TestUnixSockServer(unittest.TestCase):
|
|
|
self.assertEqual((socket.AF_INET, socket.SOCK_STREAM,
|
|
|
('127.0.0.1', 12345)),
|
|
|
self.unix._guess_remote(sock.fileno()))
|
|
|
+ sock.close()
|
|
|
if socket.has_ipv6:
|
|
|
# Don't check IPv6 address on hosts not supporting them
|
|
|
sock = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
|
|
@@ -1208,6 +1209,7 @@ class TestUnixSockServer(unittest.TestCase):
|
|
|
self.assertEqual((socket.AF_INET6, socket.SOCK_STREAM,
|
|
|
('::1', 12345, 0, 0)),
|
|
|
self.unix._guess_remote(sock.fileno()))
|
|
|
+ sock.close()
|
|
|
# Try when pretending there's no IPv6 support
|
|
|
# (No need to pretend when there's really no IPv6)
|
|
|
xfrout.socket.has_ipv6 = False
|
|
@@ -1218,6 +1220,7 @@ class TestUnixSockServer(unittest.TestCase):
|
|
|
self.unix._guess_remote(sock.fileno()))
|
|
|
# Return it back
|
|
|
xfrout.socket.has_ipv6 = True
|
|
|
+ sock.close()
|
|
|
|
|
|
def test_receive_query_message(self):
|
|
|
send_msg = b"\xd6=\x00\x00\x00\x01\x00"
|
|
@@ -1379,6 +1382,7 @@ class TestUnixSockServer(unittest.TestCase):
|
|
|
old_stdout = sys.stdout
|
|
|
sys.stdout = open(os.devnull, 'w')
|
|
|
self.assertTrue(self.unix._sock_file_in_use(sock_file))
|
|
|
+ sys.stdout.close()
|
|
|
sys.stdout = old_stdout
|
|
|
|
|
|
def test_remove_unused_sock_file_in_use(self):
|
|
@@ -1395,7 +1399,7 @@ class TestUnixSockServer(unittest.TestCase):
|
|
|
else:
|
|
|
# This should never happen
|
|
|
self.assertTrue(False)
|
|
|
-
|
|
|
+ sys.stdout.close()
|
|
|
sys.stdout = old_stdout
|
|
|
|
|
|
def test_remove_unused_sock_file_dir(self):
|
|
@@ -1411,6 +1415,7 @@ class TestUnixSockServer(unittest.TestCase):
|
|
|
# This should never happen
|
|
|
self.assertTrue(False)
|
|
|
|
|
|
+ sys.stdout.close()
|
|
|
sys.stdout = old_stdout
|
|
|
os.rmdir(dir_name)
|
|
|
|