diff --git a/src/niveristand/_translation/py2rtseq/custom_generate_error.py b/src/niveristand/_translation/py2rtseq/custom_generate_error.py index 77b63c3..ad83f07 100644 --- a/src/niveristand/_translation/py2rtseq/custom_generate_error.py +++ b/src/niveristand/_translation/py2rtseq/custom_generate_error.py @@ -13,7 +13,7 @@ def custom_generate_error(node, resources): error_code = eval(utils.generic_ast_node_transform(node.args[0], resources)) except NameError: raise TranslateError(_errormessages.invalid_error_code_for_generate_error) - message = node.args[1].s + message = node.args[1].value action = ErrorAction[node.args[2].attr] realtimesequencedefinition.add_generate_error( resources.get_current_block(), error_code, message, action.value diff --git a/src/niveristand/_translation/py2rtseq/functiondef_transformer.py b/src/niveristand/_translation/py2rtseq/functiondef_transformer.py index 7336c81..29127d8 100644 --- a/src/niveristand/_translation/py2rtseq/functiondef_transformer.py +++ b/src/niveristand/_translation/py2rtseq/functiondef_transformer.py @@ -59,7 +59,7 @@ def _decorator_to_arg(node, resources): by_value_str = utils.get_variable_name_from_node(node.args[2]) by_value_str = getattr(_decorators.NivsParam, by_value_str.split(".")[-1], by_value_str) by_value = BooleanValue(by_value_str).value - elif "NameConstant" in dir(ast) and utils.is_node_ast_nameconstant(node.args[2]): + elif "Constant" in dir(ast) and utils.is_node_ast_nameconstant(node.args[2]): by_value = utils.get_value_from_nameconstant_node(node.args[2]) if arg_name is None or def_value is None or by_value is None: diff --git a/src/niveristand/_translation/py2rtseq/unittests/test_nameconstant_transformer.py b/src/niveristand/_translation/py2rtseq/unittests/test_nameconstant_transformer.py index da7c42c..5f23b02 100644 --- a/src/niveristand/_translation/py2rtseq/unittests/test_nameconstant_transformer.py +++ b/src/niveristand/_translation/py2rtseq/unittests/test_nameconstant_transformer.py @@ -5,18 +5,18 @@ def test_true_node_returns_true_string(): - node = ast.NameConstant(value=True) + node = ast.Constant(value=True) res = nameconstant_transformer.nameconstant_transformer(node, None) assert res == "true" def test_false_node_returns_false_string(): - node = ast.NameConstant(value=False) + node = ast.Constant(value=False) res = nameconstant_transformer.nameconstant_transformer(node, None) assert res == "false" def test_none_node_throws(): - node = ast.NameConstant(value=None) + node = ast.Constant(value=None) with pytest.raises(errors.TranslateError): nameconstant_transformer.nameconstant_transformer(node, None) diff --git a/tox.ini b/tox.ini index fa87c2e..c43b85f 100644 --- a/tox.ini +++ b/tox.ini @@ -39,6 +39,7 @@ deps = flake8-junit-report commands = - flake8 src/niveristand/ tests/ examples/ setup.py --exclude tests/legacy,tests/sdf_api,_auto_generated_classes.py,src/niveristand/**/__init__.py --output-file {envlogdir}/{envname}.txt --tee + python -c "open(r'{envlogdir}/{envname}.txt', 'a').close()" flake8_junit {envlogdir}/{envname}.txt {envlogdir}/junit-{envname}.xml [flake8]