Author: Stephan <step...@stzal.com> Branch: Changeset: r317:7ef91b236940 Date: 2012-12-11 16:35 +0100 http://bitbucket.org/pypy/lang-js/changeset/7ef91b236940/
Log: pep8 diff --git a/js/execution_context.py b/js/execution_context.py --- a/js/execution_context.py +++ b/js/execution_context.py @@ -190,6 +190,7 @@ class FunctionExecutionContext(ExecutionContext): _immutable_fields_ = ['_scope_', '_calling_context_'] _refs_resizable_ = False + def __init__(self, code, formal_parameters=[], argv=[], this=w_Undefined, strict=False, scope=None, w_func=None): from js.jsobj import isnull_or_undefined, W_BasicObject from js.object_space import object_space diff --git a/js/operations.py b/js/operations.py --- a/js/operations.py +++ b/js/operations.py @@ -787,6 +787,7 @@ trycode = JsCode() self.tryblock.emit(trycode) + tryexec = JsExecutableCode(trycode) if self.catchblock: diff --git a/js/test/ecma/conftest.py b/js/test/ecma/conftest.py --- a/js/test/ecma/conftest.py +++ b/js/test/ecma/conftest.py @@ -8,7 +8,7 @@ from pypy.rlib.parsing.parsing import ParseError EXCLUSIONLIST = ['shell.js', 'browser.js'] -SKIP = [\ +SKIP = [ '7.2-1.0', '7.2-1.1', '7.2-1.2', @@ -133,31 +133,32 @@ '15.5.4.12-1.184', '15.5.4.12-4.80', '15.5.4.12-4.93', - ] +] def pytest_ignore_collect(path, config): if path.basename in EXCLUSIONLIST: return True + def pytest_collect_file(path, parent): if path.ext == ".js": return JSTestFile(path, parent=parent) + def pytest_addoption(parser): parser.addoption('--ecma', - action="store_true", dest="ecma", default=False, - help="run js interpreter ecma tests" - ) + action="store_true", dest="ecma", default=False, + help="run js interpreter ecma tests") parser.addoption('--ecma-compile', - action="store_true", dest="ecma-compile", default=False, - help="run js interpreter ecma tests" - ) + action="store_true", dest="ecma-compile", default=False, + help="run js interpreter ecma tests") rootdir = py.path.local(__file__).dirpath() -shellpath = rootdir/'shell.js' +shellpath = rootdir / 'shell.js' _compiled_f = None + class InterpreterResults(object): compiled_interpreter = None @@ -166,7 +167,7 @@ def get_interp(self): def f(testfile): - interp = Interpreter({'no-exception-jseval':True}) + interp = Interpreter({'no-exception-jseval': True}) interp.run_file(str(shellpath)) interp.run_file(testfile) @@ -182,10 +183,10 @@ for number in xrange(testcount): w_test_number = _w(number) - result_obj = run_test_func.Call(args = [w_test_number]) + result_obj = run_test_func.Call(args=[w_test_number]) result_passed = result_obj.get(u'passed').to_boolean() result_reason = str(result_obj.get(u'reason').to_string()) - test_results.append({'number': number, 'passed':result_passed, 'reason':result_reason}) + test_results.append({'number': number, 'passed': result_passed, 'reason': result_reason}) return test_results @@ -201,12 +202,12 @@ interp = self.get_interp() return interp(test_file) + class JSTestFile(pytest.File): def __init__(self, fspath, parent=None, config=None, session=None): super(JSTestFile, self).__init__(fspath, parent, config, session) self.name = self.fspath.purebasename - def collect(self): if self.session.config.getvalue("ecma") is not True: pytest.skip("ECMA tests disabled, run with --ecma") @@ -219,10 +220,9 @@ try: results = interp.get_results(str(self.fspath)) except ParseError, e: - raise Failed(msg=e.nice_error_message(filename=str(self.fspath))) #, excinfo=None) + raise Failed(msg=e.nice_error_message(filename=str(self.fspath))) # excinfo=None) except JsException, e: - import pdb; pdb.set_trace() - raise Failed(msg="Javascript Error: "+str(e)) #, excinfo=py.code.ExceptionInfo()) + raise Failed(msg="Javascript Error: " + str(e)) # excinfo=py.code.ExceptionInfo()) for test_result in results: number = test_result.get('number') @@ -230,6 +230,7 @@ reason = test_result.get('reason') yield JSTestItem(str(number), passed, reason, parent=self) + class JSTestItem(pytest.Item): def __init__(self, name, passed, reason, parent=None, config=None, session=None): super(JSTestItem, self).__init__(name, parent, config, session) @@ -243,8 +244,9 @@ passed = self.passed if self.name in SKIP: py.test.skip() - __tracebackhide__ = True - if passed != True: + + # __tracebackhide__ = True + if passed is False: raise JsTestException(self, reason) def repr_failure(self, excinfo): @@ -257,8 +259,8 @@ _handling_traceback = False + class JsTestException(Exception): def __init__(self, item, result): self.item = item self.result = result - _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit