tests: Add strategic sleeps to reduce likelihood of race condition during test teardown
This commit is contained in:
parent
3c25b1d9f3
commit
85aaed090f
1 changed files with 6 additions and 1 deletions
|
|
@ -577,8 +577,8 @@ class TestLifecycle(unittest.TestCase):
|
||||||
mock.call({'event': 'start-file', 'playlist_entry_id': 1}),
|
mock.call({'event': 'start-file', 'playlist_entry_id': 1}),
|
||||||
mock.call({'event': 'end-file', 'reason': 'error', 'playlist_entry_id': 1, 'file_error': 'no audio or video data played'})
|
mock.call({'event': 'end-file', 'reason': 'error', 'playlist_entry_id': 1, 'file_error': 'no audio or video data played'})
|
||||||
], any_order=True)
|
], any_order=True)
|
||||||
|
time.sleep(1)
|
||||||
handler.reset_mock()
|
handler.reset_mock()
|
||||||
|
|
||||||
m.terminate()
|
m.terminate()
|
||||||
handler.assert_not_called()
|
handler.assert_not_called()
|
||||||
|
|
||||||
|
|
@ -600,6 +600,7 @@ class TestLifecycle(unittest.TestCase):
|
||||||
t.start()
|
t.start()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
m.terminate()
|
m.terminate()
|
||||||
|
time.sleep(1)
|
||||||
t.join()
|
t.join()
|
||||||
self.disp.stop()
|
self.disp.stop()
|
||||||
assert result.result()
|
assert result.result()
|
||||||
|
|
@ -620,6 +621,7 @@ class TestLifecycle(unittest.TestCase):
|
||||||
m.mute = True
|
m.mute = True
|
||||||
t.join()
|
t.join()
|
||||||
m.terminate()
|
m.terminate()
|
||||||
|
time.sleep(1)
|
||||||
handler.assert_called()
|
handler.assert_called()
|
||||||
self.disp.stop()
|
self.disp.stop()
|
||||||
|
|
||||||
|
|
@ -655,6 +657,7 @@ class TestLifecycle(unittest.TestCase):
|
||||||
# handle
|
# handle
|
||||||
with m.prepare_and_wait_for_property('mute', level_sensitive=False):
|
with m.prepare_and_wait_for_property('mute', level_sensitive=False):
|
||||||
m.terminate()
|
m.terminate()
|
||||||
|
time.sleep(1)
|
||||||
self.disp.stop()
|
self.disp.stop()
|
||||||
|
|
||||||
@unittest.skipIf('test_wait_for_property_event_overflow' in SKIP_TESTS, reason="kills X-Server first")
|
@unittest.skipIf('test_wait_for_property_event_overflow' in SKIP_TESTS, reason="kills X-Server first")
|
||||||
|
|
@ -675,6 +678,8 @@ class TestLifecycle(unittest.TestCase):
|
||||||
m.command_async('script-message', 'foo', 'bar')
|
m.command_async('script-message', 'foo', 'bar')
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
m.terminate()
|
||||||
|
time.sleep(1)
|
||||||
self.disp.stop()
|
self.disp.stop()
|
||||||
|
|
||||||
def test_wait_for_event_shutdown(self):
|
def test_wait_for_event_shutdown(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue