From 753253772ae21eca67dea92cde9f7dd430c20cba Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Thu, 3 May 2018 17:12:36 -0400 Subject: [PATCH] Python 3: Fix non-deterministic test The order that kill() is called on the child processes of a service is determined by iterating over a dict, so don't hard-code a particular expected order in the test. Doing that caused the test to be broken on Python 3. Change-Id: I4ca85cc8f559985b133e523cd00f297e5576d00a --- oslo_service/tests/test_service.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/oslo_service/tests/test_service.py b/oslo_service/tests/test_service.py index a0a139ef..ed678069 100644 --- a/oslo_service/tests/test_service.py +++ b/oslo_service/tests/test_service.py @@ -454,9 +454,10 @@ class ProcessLauncherTest(base.ServiceBaseTestCase): self.assertFalse(launcher.running) self.assertFalse(launcher.children) - self.assertEqual([mock.call(222, signal_mock.SIGTERM), - mock.call(22, signal_mock.SIGTERM)], - mock_kill.mock_calls) + mock_kill.assert_has_calls([mock.call(222, signal_mock.SIGTERM), + mock.call(22, signal_mock.SIGTERM)], + any_order=True) + self.assertEqual(2, mock_kill.call_count) mock_service_stop.assert_called_once_with() def test__handle_signal(self):