From 5feb31a42f13c2e34df4b76a0b722b3fa7c439e0 Mon Sep 17 00:00:00 2001 From: Peter Mikus Date: Fri, 14 Jan 2022 15:02:31 +0100 Subject: [PATCH] fix(uti): Fixing broken code part V - UTI export breaks local execution - disabling useless tox rules Signed-off-by: Peter Mikus Change-Id: I2f610b08f06f437e4482f291fa7b47cbb7b92984 --- .gitignore | 4 +++- resources/libraries/bash/entry/check/model_version.sh | 4 ++-- resources/libraries/python/model/mem2raw.py | 4 ++-- resources/libraries/python/model/raw2info.py | 6 +++--- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index a693a1be03..7ea1215cff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Cisco and/or its affiliates. +# Copyright (c) 2022 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -25,3 +25,5 @@ report.html *.pyc *~ .idea +*.raw.json +*.info.json \ No newline at end of file diff --git a/resources/libraries/bash/entry/check/model_version.sh b/resources/libraries/bash/entry/check/model_version.sh index c886447900..2bcc628bfb 100644 --- a/resources/libraries/bash/entry/check/model_version.sh +++ b/resources/libraries/bash/entry/check/model_version.sh @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Cisco and/or its affiliates. +# Copyright (c) 2022 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -33,7 +33,7 @@ source "${BASH_FUNCTION_DIR}/common.sh" || { impl_log="edited_files.log" git diff --name-only HEAD~ > "${impl_log}" -if ! grep -q '^resources/libraries/python/model' "${impl_log}"; then +if ! grep -q '^docs/model/current/schema/test_case*' "${impl_log}"; then # Failing grep means no model edits. warn "No model implementation edits detected." warn diff --git a/resources/libraries/python/model/mem2raw.py b/resources/libraries/python/model/mem2raw.py index c3145b9f31..543ee935e2 100644 --- a/resources/libraries/python/model/mem2raw.py +++ b/resources/libraries/python/model/mem2raw.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Cisco and/or its affiliates. +# Copyright (c) 2022 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -141,5 +141,5 @@ def write_raw_output(raw_file_path, raw_data): """ raw_data = _pre_serialize_root(raw_data) os.makedirs(os.path.dirname(raw_file_path), exist_ok=True) - with open(raw_file_path, u"xt", encoding="utf-8") as file_out: + with open(raw_file_path, u"wt", encoding="utf-8") as file_out: json.dump(raw_data, file_out, indent=1) diff --git a/resources/libraries/python/model/raw2info.py b/resources/libraries/python/model/raw2info.py index 7a3647d857..bd7d0e3cf1 100644 --- a/resources/libraries/python/model/raw2info.py +++ b/resources/libraries/python/model/raw2info.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Cisco and/or its affiliates. +# Copyright (c) 2022 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -257,7 +257,7 @@ def _merge_into_suite_info_file(teardown_info_path): suite_data[u"teardown_log"] = teardown_data[u"log"] suite_info_path = u"suite".join(teardown_info_path.rsplit(u"teardown", 1)) - with open(suite_info_path, u"xt", encoding="utf-8") as file_out: + with open(suite_info_path, u"wt", encoding="utf-8") as file_out: json.dump(suite_data, file_out, indent=1) # We moved everything useful from temporary setup/teardown info files. os.remove(setup_info_path) @@ -285,7 +285,7 @@ def convert_content_to_info(from_raw_path): data = _convert_to_info_in_memory(data) - with open(to_info_path, u"xt", encoding="utf-8") as file_out: + with open(to_info_path, u"wt", encoding="utf-8") as file_out: json.dump(data, file_out, indent=1) if to_info_path.endswith(u"/teardown.info.json"): to_info_path = _merge_into_suite_info_file(to_info_path) -- 2.16.6