Minor improvements to test framework
Show correct module for test Print error output
This commit is contained in:
parent
6af132bb5f
commit
529166867f
12
eos/tests.py
12
eos/tests.py
@ -51,7 +51,13 @@ class BaseJSTestCase(TestCase):
|
|||||||
def add_method(cls, method):
|
def add_method(cls, method):
|
||||||
def call_method(self, *args):
|
def call_method(self, *args):
|
||||||
# TODO: 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)
|
setattr(cls, method, call_method)
|
||||||
|
|
||||||
# Test discovery
|
# Test discovery
|
||||||
@ -74,8 +80,8 @@ def run_tests(prefix=None, lang=None):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
impl = obj()
|
impl = obj()
|
||||||
cls_py = type(name + 'ImplPy', (BasePyTestCase,), {'impl': impl})
|
cls_py = type(name + 'ImplPy', (BasePyTestCase,), {'__module__': module_name, 'impl': impl})
|
||||||
cls_js = type(name + 'ImplJS', (BaseJSTestCase,), {'module': module_name, 'name': name})
|
cls_js = type(name + 'ImplJS', (BaseJSTestCase,), {'__module__': module_name, 'module': module_name, 'name': name})
|
||||||
for method in dir(impl):
|
for method in dir(impl):
|
||||||
method_val = getattr(impl, method)
|
method_val = getattr(impl, method)
|
||||||
if isinstance(method_val, types.MethodType) and not hasattr(cls_py, method):
|
if isinstance(method_val, types.MethodType) and not hasattr(cls_py, method):
|
||||||
|
Loading…
Reference in New Issue
Block a user