Skip to content
Snippets Groups Projects
Commit 50a815a9 authored by inso's avatar inso
Browse files

Clean code

parent 839c1934
No related branches found
No related tags found
No related merge requests found
__version_info__ = ('0', '20', '7') __version_info__ = ('0', '30', '0')
__version__ = '.'.join(__version_info__) __version__ = '.'.join(__version_info__)
import attr import attr
from duniterpy.documents import block_uid
@attr.s() @attr.s()
......
import attr import attr
from duniterpy.documents import block_uid
@attr.s() @attr.s()
......
from .quamash_utils import QuamashTest
\ No newline at end of file
import asyncio
import quamash
import socket
from aiohttp import web, log
_application_ = []
class QuamashTest:
def setUpQuamash(self):
self.qapplication = get_application()
self.lp = quamash.QSelectorEventLoop(self.qapplication)
asyncio.set_event_loop(self.lp)
self.lp.set_exception_handler(lambda l, c: unitttest_exception_handler(self, l, c))
self.exceptions = []
self.handler = None
def tearDownQuamash(self):
try:
self.lp.close()
finally:
asyncio.set_event_loop(None)
for exc in self.exceptions:
raise exc
def unitttest_exception_handler(test, loop, context):
"""
An exception handler which exists the program if the exception
was not catch
:param loop: the asyncio loop
:param context: the exception context
"""
if 'exception' in context:
exception = context['exception']
else:
exception = BaseException(context['message'])
test.exceptions.append(exception)
def get_application():
"""Get the singleton QApplication"""
from quamash import QApplication
if not len(_application_):
application = QApplication.instance()
if not application:
import sys
application = QApplication(sys.argv)
_application_.append( application )
return _application_[0]
from sakia.data.repositories import CertificationsRepo from sakia.data.repositories import CertificationsRepo
from sakia.data.entities import Certification from sakia.data.entities import Certification
from duniterpy.documents import BlockUID
def test_add_get_drop_blockchain(meta_repo): def test_add_get_drop_blockchain(meta_repo):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment