diff --git a/neutron/tests/unit/agent/linux/test_daemon.py b/neutron/tests/unit/agent/linux/test_daemon.py index c093909f05a..5730df2f40f 100644 --- a/neutron/tests/unit/agent/linux/test_daemon.py +++ b/neutron/tests/unit/agent/linux/test_daemon.py @@ -37,10 +37,11 @@ class FakeEntry(object): class TestUnwatchLog(base.BaseTestCase): def test_unwatch_log(self): + temp_file_name = self.get_temp_file_path('unwatch_log_temp_file_name') stream_handler = logging.StreamHandler() logger = logging.Logger('fake') logger.addHandler(stream_handler) - logger.addHandler(handlers.WatchedFileHandler('/tmp/filename1')) + logger.addHandler(handlers.WatchedFileHandler(temp_file_name)) with mock.patch('logging.getLogger', return_value=logger): daemon.unwatch_log() @@ -48,7 +49,7 @@ class TestUnwatchLog(base.BaseTestCase): logger.handlers.remove(stream_handler) observed = logger.handlers[0] self.assertEqual(logging.FileHandler, type(observed)) - self.assertEqual('/tmp/filename1', observed.baseFilename) + self.assertEqual(temp_file_name, observed.baseFilename) class TestPrivileges(base.BaseTestCase):