Fix player test fork() on macOS

This commit is contained in:
Matthew Stratford 2021-04-08 22:56:57 +01:00
parent 066a696b5c
commit 119b729c56
2 changed files with 4 additions and 1 deletions

View file

@ -1,3 +1,4 @@
from helpers.os_environment import isMacOS
from queue import Empty from queue import Empty
import unittest import unittest
import multiprocessing import multiprocessing
@ -285,4 +286,7 @@ class TestPlayer(unittest.TestCase):
# runs the unit tests in the module # runs the unit tests in the module
if __name__ == "__main__": if __name__ == "__main__":
# Fixes fork error.
if isMacOS():
multiprocessing.set_start_method("spawn", True)
unittest.main() unittest.main()

View file

@ -233,6 +233,5 @@ class WebsocketServer:
await asyncio.sleep(0.02) await asyncio.sleep(0.02)
if __name__ == "__main__": if __name__ == "__main__":
print("Don't do this") print("Don't do this")