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
This commit is contained in:
Peter Šurda 2022-08-01 17:07:20 +08:00
parent eb5f791cb6
commit 36c2a80060
Signed by: PeterSurda
GPG Key ID: 3E47497CF67ABB95
3 changed files with 12 additions and 7 deletions

View File

@ -1,7 +1,11 @@
"""Mock kivy app with mock threads.""" """Mock kivy app with mock threads."""
# pylint: disable=unused-import
# flake8: noqa:E401
from pybitmessage import state from pybitmessage import state
from pybitmessage.bitmessagekivy.mpybit import NavigateApp from pybitmessage.bitmessagekivy.mpybit import NavigateApp
import multiqueue
from class_addressGenerator import FakeAddressGenerator from class_addressGenerator import FakeAddressGenerator

7
src/mock/multiqueue.py Normal file
View File

@ -0,0 +1,7 @@
"""
Mock MultiQueue (just normal Queue)
"""
from six.moves import queue
MultiQueue = queue.Queue

View File

@ -8,13 +8,7 @@ from six.moves import queue
try: try:
from multiqueue import MultiQueue from multiqueue import MultiQueue
except ImportError: except ImportError:
try: from .multiqueue import MultiQueue
from .multiqueue import MultiQueue
except ImportError:
import sys
if 'bitmessagemock' not in sys.modules:
raise
MultiQueue = queue.Queue
class ObjectProcessorQueue(queue.Queue): class ObjectProcessorQueue(queue.Queue):