From 84b5f2982cef6d4a39396243525fda33393636bb Mon Sep 17 00:00:00 2001
From: Dmitri Bogomolov <4glitch@gmail.com>
Date: Thu, 22 Oct 2020 13:23:11 +0300
Subject: [PATCH] Allow running pybitmessage -t without tests package

---
 src/bitmessagemain.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/bitmessagemain.py b/src/bitmessagemain.py
index a0a6a025..06b8b8a5 100755
--- a/src/bitmessagemain.py
+++ b/src/bitmessagemain.py
@@ -371,10 +371,14 @@ class Main(object):
                     self.stop()
         elif not state.enableGUI:
             state.enableGUI = True
-            # pylint: disable=relative-import
-            from tests import core as test_core
+            try:
+                # pylint: disable=relative-import
+                from tests import core as test_core
+            except ImportError:
+                self.stop()
+                return
+
             test_core_result = test_core.run()
-            state.enableGUI = True
             self.stop()
             test_core.cleanup()
             sys.exit(