From 119b729c56cd187b150646e58d850dc4ef578fdf Mon Sep 17 00:00:00 2001 From: Matthew Stratford Date: Thu, 8 Apr 2021 22:56:57 +0100 Subject: [PATCH] Fix player test fork() on macOS --- tests/test_player.py | 4 ++++ websocket_server.py | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_player.py b/tests/test_player.py index e09d59f..cb8806c 100644 --- a/tests/test_player.py +++ b/tests/test_player.py @@ -1,3 +1,4 @@ +from helpers.os_environment import isMacOS from queue import Empty import unittest import multiprocessing @@ -285,4 +286,7 @@ class TestPlayer(unittest.TestCase): # runs the unit tests in the module if __name__ == "__main__": + # Fixes fork error. + if isMacOS(): + multiprocessing.set_start_method("spawn", True) unittest.main() diff --git a/websocket_server.py b/websocket_server.py index c22d921..dcbd14f 100644 --- a/websocket_server.py +++ b/websocket_server.py @@ -233,6 +233,5 @@ class WebsocketServer: await asyncio.sleep(0.02) - if __name__ == "__main__": print("Don't do this")