From 529166867f6e515e890da59d7b8c5bfaa9e29c00 Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Fri, 24 Nov 2017 19:38:13 +1100 Subject: [PATCH] Minor improvements to test framework Show correct module for test Print error output --- eos/tests.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/eos/tests.py b/eos/tests.py index 212fed3..5855301 100644 --- a/eos/tests.py +++ b/eos/tests.py @@ -51,7 +51,13 @@ class BaseJSTestCase(TestCase): def add_method(cls, method): def call_method(self, *args): # TODO: args - return cls.ctx.eval('test.' + method + '()') + try: + return cls.ctx.eval('test.' + method + '()') + except execjs._exceptions.ProcessExitedWithNonZeroStatus as ex: + import traceback + traceback.print_exc() + print(ex.stderr) + self.fail() setattr(cls, method, call_method) # Test discovery @@ -74,8 +80,8 @@ def run_tests(prefix=None, lang=None): continue impl = obj() - cls_py = type(name + 'ImplPy', (BasePyTestCase,), {'impl': impl}) - cls_js = type(name + 'ImplJS', (BaseJSTestCase,), {'module': module_name, 'name': name}) + cls_py = type(name + 'ImplPy', (BasePyTestCase,), {'__module__': module_name, 'impl': impl}) + cls_js = type(name + 'ImplJS', (BaseJSTestCase,), {'__module__': module_name, 'module': module_name, 'name': name}) for method in dir(impl): method_val = getattr(impl, method) if isinstance(method_val, types.MethodType) and not hasattr(cls_py, method):