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
This commit is contained in:
Zane Bitter 2018-05-03 17:12:36 -04:00
parent 6978eb1a28
commit 753253772a
1 changed files with 4 additions and 3 deletions

View File

@ -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):