From 395a3a8075ca2c6c8fe0163e2c79451b4c99d6e0 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Wed, 16 Aug 2017 11:00:21 -0400 Subject: [PATCH] Fix test_daemon_no_cleanup_for_uninitialized_server When mocking daemon_start(), define a string return value for tempfile.mkdtemp(), ensuring temp_dir is a string when passed to os.path.join(temp_dir, "rootwrap.sock"). Change-Id: I502c9cc53f40cbea89243a2321d1bc63f05e7c7b Closes-Bug: 1709505 --- oslo_rootwrap/tests/test_rootwrap.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/oslo_rootwrap/tests/test_rootwrap.py b/oslo_rootwrap/tests/test_rootwrap.py index 13c7282..658fcb0 100644 --- a/oslo_rootwrap/tests/test_rootwrap.py +++ b/oslo_rootwrap/tests/test_rootwrap.py @@ -653,6 +653,7 @@ class DaemonCleanupTestCase(testtools.TestCase): @mock.patch('tempfile.mkdtemp') @mock.patch('multiprocessing.managers.BaseManager.get_server', side_effect=DaemonCleanupException) - def test_daemon_no_cleanup_for_uninitialized_server(self, gs, *args): + def test_daemon_no_cleanup_for_uninitialized_server(self, gs, mkd, *args): + mkd.return_value = '/tmp/123' self.assertRaises(DaemonCleanupException, daemon.daemon_start, config=None, filters=None)