Improved logging and updated modules

This commit is contained in:
2020-11-22 20:56:31 +01:00
parent be62b173d3
commit 413800f2c3
27 changed files with 158 additions and 130 deletions

View File

@@ -1,12 +1,10 @@
import os
import sys
import traceback
from typing import Optional
from termcolor import colored
from sh_edraft.configuration import ApplicationHost
from sh_edraft.service import ServiceProvider
from tests.logger import LoggerTest
from tests.publisher import PublisherTest
from tests.service_provider import ServiceProviderTest
@@ -16,7 +14,6 @@ class Tester:
def __init__(self):
self._app_host = ApplicationHost()
self._services: Optional[ServiceProvider] = None
self._error: bool = False
@@ -46,7 +43,14 @@ class Tester:
def create(self): pass
def start(self):
self.disable_print()
if not self._error:
try:
LoggerTest.start(self._app_host)
self.success(f'{LoggerTest.__name__} test succeeded.')
except Exception as e:
self._error = True
self.failed(f'{LoggerTest.__name__} test failed!\n{e}')
self.exception()
if not self._error:
try:
@@ -57,15 +61,6 @@ class Tester:
self.failed(f'{ServiceProviderTest.__name__} test failed!\n{e}')
self.exception()
if not self._error:
try:
LoggerTest.start(self._app_host)
self.success(f'{LoggerTest.__name__} test succeeded.')
except Exception as e:
self._error = True
self.failed(f'{LoggerTest.__name__} test failed!\n{e}')
self.exception()
if not self._error:
try:
PublisherTest.start(self._app_host.services)
@@ -79,4 +74,6 @@ class Tester:
if __name__ == '__main__':
tester = Tester()
tester.create()
tester.disable_print()
tester.start()
tester.enable_print()