From d6823a6fb1fcb72622b98e01a6203360f0e8e377 Mon Sep 17 00:00:00 2001
From: Peter Surda <peter@bitmessage.at>
Date: Sun, 7 Jul 2024 20:07:26 +0800
Subject: [PATCH] Fix python3 / kivy test

---
 src/bitmessagekivy/tests/telenium_process.py |  7 ++++++-
 src/highlevelcrypto.py                       | 14 ++++++++++----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/bitmessagekivy/tests/telenium_process.py b/src/bitmessagekivy/tests/telenium_process.py
index 0a81044d..209287e2 100644
--- a/src/bitmessagekivy/tests/telenium_process.py
+++ b/src/bitmessagekivy/tests/telenium_process.py
@@ -7,6 +7,8 @@ import shutil
 import tempfile
 from time import time, sleep
 
+from requests.exceptions import ChunkedEncodingError
+
 from telenium.tests import TeleniumTestCase
 from telenium.client import TeleniumHttpException
 
@@ -54,7 +56,10 @@ class TeleniumTestProcess(TeleniumTestCase):
     def tearDownClass(cls):
         """Ensures that pybitmessage stopped and removes files"""
         # pylint: disable=no-member
-        super(TeleniumTestProcess, cls).tearDownClass()
+        try:
+            super(TeleniumTestProcess, cls).tearDownClass()
+        except ChunkedEncodingError:
+            pass
         cleanup()
 
     def assert_wait_no_except(self, selector, timeout=-1, value='inbox'):
diff --git a/src/highlevelcrypto.py b/src/highlevelcrypto.py
index d59a721d..b83da2f3 100644
--- a/src/highlevelcrypto.py
+++ b/src/highlevelcrypto.py
@@ -11,11 +11,17 @@ import hashlib
 import os
 from binascii import hexlify
 
-import pyelliptic
-from pyelliptic import OpenSSL
-from pyelliptic import arithmetic as a
+try:
+    import pyelliptic
+    from fallback import RIPEMD160Hash
+    from pyelliptic import OpenSSL
+    from pyelliptic import arithmetic as a
+except ImportError:
+    from pybitmessage import pyelliptic
+    from pybitmessage.fallback import RIPEMD160Hash
+    from pybitmessage.pyelliptic import OpenSSL
+    from pybitmessage.pyelliptic import arithmetic as a
 
-from fallback import RIPEMD160Hash
 
 __all__ = [
     'decodeWalletImportFormat', 'deterministic_keys',
-- 
2.45.1