From 36c2a8006048b11fc7589040954c2b022135eed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0urda?= Date: Mon, 1 Aug 2022 17:07:20 +0800 Subject: [PATCH] Mock multiqueue - kivy mock now uses a mock multiqueue, as the existing code didn't handle all problems. For example, trying to load OpenSSL currently crashes on my M1 Mac, so I can't even add an exception handler to fall back. With this patch, the kivy_mock simply forces a fallback to Queue --- src/mock/kivy_main.py | 4 ++++ src/mock/multiqueue.py | 7 +++++++ src/queues.py | 8 +------- 3 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 src/mock/multiqueue.py diff --git a/src/mock/kivy_main.py b/src/mock/kivy_main.py index badc1dc1..7fe330f6 100644 --- a/src/mock/kivy_main.py +++ b/src/mock/kivy_main.py @@ -1,7 +1,11 @@ """Mock kivy app with mock threads.""" +# pylint: disable=unused-import +# flake8: noqa:E401 from pybitmessage import state from pybitmessage.bitmessagekivy.mpybit import NavigateApp + +import multiqueue from class_addressGenerator import FakeAddressGenerator diff --git a/src/mock/multiqueue.py b/src/mock/multiqueue.py new file mode 100644 index 00000000..8ec76920 --- /dev/null +++ b/src/mock/multiqueue.py @@ -0,0 +1,7 @@ +""" +Mock MultiQueue (just normal Queue) +""" + +from six.moves import queue + +MultiQueue = queue.Queue diff --git a/src/queues.py b/src/queues.py index d86d36fa..4a9b98d2 100644 --- a/src/queues.py +++ b/src/queues.py @@ -8,13 +8,7 @@ from six.moves import queue try: from multiqueue import MultiQueue except ImportError: - try: - from .multiqueue import MultiQueue - except ImportError: - import sys - if 'bitmessagemock' not in sys.modules: - raise - MultiQueue = queue.Queue + from .multiqueue import MultiQueue class ObjectProcessorQueue(queue.Queue):