summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_logging.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_logging.py')
-rw-r--r--Lib/test/test_logging.py27
1 files changed, 6 insertions, 21 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index f4a4324..7859c60 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -1828,12 +1828,6 @@ class SocketHandlerTest(BaseTest):
time.sleep(self.sock_hdlr.retryTime - now + 0.001)
self.root_logger.error('Nor this')
-def _get_temp_domain_socket():
- fn = make_temp_file(prefix='test_logging_', suffix='.sock')
- # just need a name - file can't be present, or we'll get an
- # 'address already in use' error.
- os.remove(fn)
- return fn
@unittest.skipUnless(hasattr(socket, "AF_UNIX"), "Unix sockets required")
class UnixSocketHandlerTest(SocketHandlerTest):
@@ -1845,13 +1839,10 @@ class UnixSocketHandlerTest(SocketHandlerTest):
def setUp(self):
# override the definition in the base class
- self.address = _get_temp_domain_socket()
+ self.address = socket_helper.create_unix_domain_name()
+ self.addCleanup(os_helper.unlink, self.address)
SocketHandlerTest.setUp(self)
- def tearDown(self):
- SocketHandlerTest.tearDown(self)
- os_helper.unlink(self.address)
-
@support.requires_working_socket()
@threading_helper.requires_working_threading()
class DatagramHandlerTest(BaseTest):
@@ -1928,13 +1919,10 @@ class UnixDatagramHandlerTest(DatagramHandlerTest):
def setUp(self):
# override the definition in the base class
- self.address = _get_temp_domain_socket()
+ self.address = socket_helper.create_unix_domain_name()
+ self.addCleanup(os_helper.unlink, self.address)
DatagramHandlerTest.setUp(self)
- def tearDown(self):
- DatagramHandlerTest.tearDown(self)
- os_helper.unlink(self.address)
-
@support.requires_working_socket()
@threading_helper.requires_working_threading()
class SysLogHandlerTest(BaseTest):
@@ -2022,13 +2010,10 @@ class UnixSysLogHandlerTest(SysLogHandlerTest):
def setUp(self):
# override the definition in the base class
- self.address = _get_temp_domain_socket()
+ self.address = socket_helper.create_unix_domain_name()
+ self.addCleanup(os_helper.unlink, self.address)
SysLogHandlerTest.setUp(self)
- def tearDown(self):
- SysLogHandlerTest.tearDown(self)
- os_helper.unlink(self.address)
-
@unittest.skipUnless(socket_helper.IPV6_ENABLED,
'IPv6 support required for this test.')
class IPv6SysLogHandlerTest(SysLogHandlerTest):