summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2022-07-11 13:49:46 +0200
committerjaseg <git@jaseg.de>2022-07-11 13:49:46 +0200
commit85aaed090f05198ce84f2c8c653ebe44c4288f8d (patch)
tree41295b7464164236d31750b5330bfefd59809bc8
parent3c25b1d9f390e7feda3514f480658c6ef6e9063a (diff)
downloadpython-mpv-85aaed090f05198ce84f2c8c653ebe44c4288f8d.tar.gz
python-mpv-85aaed090f05198ce84f2c8c653ebe44c4288f8d.tar.bz2
python-mpv-85aaed090f05198ce84f2c8c653ebe44c4288f8d.zip
tests: Add strategic sleeps to reduce likelihood of race condition during test teardown
-rwxr-xr-xtests/test_mpv.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/test_mpv.py b/tests/test_mpv.py
index c2702b5..38b0222 100755
--- a/tests/test_mpv.py
+++ b/tests/test_mpv.py
@@ -577,8 +577,8 @@ class TestLifecycle(unittest.TestCase):
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'})
], any_order=True)
+ time.sleep(1)
handler.reset_mock()
-
m.terminate()
handler.assert_not_called()
@@ -600,6 +600,7 @@ class TestLifecycle(unittest.TestCase):
t.start()
time.sleep(1)
m.terminate()
+ time.sleep(1)
t.join()
self.disp.stop()
assert result.result()
@@ -620,6 +621,7 @@ class TestLifecycle(unittest.TestCase):
m.mute = True
t.join()
m.terminate()
+ time.sleep(1)
handler.assert_called()
self.disp.stop()
@@ -655,6 +657,7 @@ class TestLifecycle(unittest.TestCase):
# handle
with m.prepare_and_wait_for_property('mute', level_sensitive=False):
m.terminate()
+ time.sleep(1)
self.disp.stop()
@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')
except:
pass
+ m.terminate()
+ time.sleep(1)
self.disp.stop()
def test_wait_for_event_shutdown(self):