A test case for core (which will be ran in main thread)

This commit is contained in:
Dmitri Bogomolov 2018-04-16 11:26:52 +03:00
parent 51df0507e2
commit a3300ba8f1
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
2 changed files with 20 additions and 0 deletions

View File

@ -367,7 +367,15 @@ class Main:
time.time() - state.last_api_response >= 30):
self.stop()
elif not state.enableGUI:
from tests import core
test_core_result = core.run()
state.enableGUI = True
self.stop()
sys.exit(
'Core tests failed!'
if test_core_result.errors or test_core_result.failures
else 0
)
def daemonize(self):
grandfatherPid = os.getpid()

12
src/tests/core.py Normal file
View File

@ -0,0 +1,12 @@
import unittest
class TestCore(unittest.TestCase):
"""Test case, which runs from main pybitmessage thread"""
def test_pass(self):
pass
def run():
suite = unittest.TestLoader().loadTestsFromTestCase(TestCore)
return unittest.TextTestRunner(verbosity=2).run(suite)