diff options
Diffstat (limited to 'resources/tools')
-rw-r--r-- | resources/tools/presentation/generator_cpta.py | 4 | ||||
-rw-r--r-- | resources/tools/presentation/generator_files.py | 2 | ||||
-rw-r--r-- | resources/tools/presentation/generator_report.py | 4 | ||||
-rw-r--r-- | resources/tools/presentation/generator_tables.py | 18 | ||||
-rw-r--r-- | resources/tools/presentation/pal_utils.py | 2 | ||||
-rwxr-xr-x | resources/tools/scripts/topo_reservation.py | 2 | ||||
-rwxr-xr-x | resources/tools/topology/update_topology.py | 4 | ||||
-rw-r--r-- | resources/tools/wrk/wrk_traffic_profile_parser.py | 2 |
8 files changed, 19 insertions, 19 deletions
diff --git a/resources/tools/presentation/generator_cpta.py b/resources/tools/presentation/generator_cpta.py index a11d1da25f..4017670427 100644 --- a/resources/tools/presentation/generator_cpta.py +++ b/resources/tools/presentation/generator_cpta.py @@ -587,7 +587,7 @@ def _generate_all_charts(spec, input_data): # Write the tables: for job_name, csv_table in csv_tables.items(): file_name = f"{spec.cpta[u'output-file']}/{job_name}-trending" - with open(f"{file_name}.csv", u"w") as file_handler: + with open(f"{file_name}.csv", u"wt") as file_handler: file_handler.writelines(csv_table) txt_table = None @@ -613,7 +613,7 @@ def _generate_all_charts(spec, input_data): ) line_nr += 1 txt_table.align[u"Build Number:"] = u"l" - with open(f"{file_name}.txt", u"w") as txt_file: + with open(f"{file_name}.txt", u"wt") as txt_file: txt_file.write(str(txt_table)) # Evaluate result: diff --git a/resources/tools/presentation/generator_files.py b/resources/tools/presentation/generator_files.py index 00a78cc99a..fdd364fc12 100644 --- a/resources/tools/presentation/generator_files.py +++ b/resources/tools/presentation/generator_files.py @@ -114,7 +114,7 @@ def file_test_results(file_spec, input_data): suites = input_data.merge_data(suites) suites.sort_index(inplace=True) - with open(file_name, u"w") as file_handler: + with open(file_name, u"wt") as file_handler: file_handler.write(rst_header) for suite_longname, suite in suites.items(): if len(suite_longname.split(u".")) <= \ diff --git a/resources/tools/presentation/generator_report.py b/resources/tools/presentation/generator_report.py index f2bf8a1cb2..0712b78ef0 100644 --- a/resources/tools/presentation/generator_report.py +++ b/resources/tools/presentation/generator_report.py @@ -158,11 +158,11 @@ def generate_html_report(release, spec, report_version): build_dir=spec.environment[u"paths"][u"DIR[BUILD,HTML]"]) execute_command(cmd) - with open(spec.environment[u"paths"][u"DIR[CSS_PATCH_FILE]"], u"w") as \ + with open(spec.environment[u"paths"][u"DIR[CSS_PATCH_FILE]"], u"wt") as \ css_file: css_file.write(THEME_OVERRIDES) - with open(spec.environment[u"paths"][u"DIR[CSS_PATCH_FILE2]"], u"w") as \ + with open(spec.environment[u"paths"][u"DIR[CSS_PATCH_FILE2]"], u"wt") as \ css_file: css_file.write(THEME_OVERRIDES) diff --git a/resources/tools/presentation/generator_tables.py b/resources/tools/presentation/generator_tables.py index 7c99ab5d72..ef8af1de69 100644 --- a/resources/tools/presentation/generator_tables.py +++ b/resources/tools/presentation/generator_tables.py @@ -138,7 +138,7 @@ def table_details(table, input_data): f"{table[u'output-file-ext']}" ) logging.info(f" Writing file: {file_name}") - with open(file_name, u"w") as file_handler: + with open(file_name, u"wt") as file_handler: file_handler.write(u",".join(header) + u"\n") for item in table_lst: file_handler.write(u",".join(item) + u"\n") @@ -212,7 +212,7 @@ def table_merged_details(table, input_data): f"{table[u'output-file-ext']}" ) logging.info(f" Writing file: {file_name}") - with open(file_name, u"w") as file_handler: + with open(file_name, u"wt") as file_handler: file_handler.write(u",".join(header) + u"\n") for item in table_lst: file_handler.write(u",".join(item) + u"\n") @@ -622,7 +622,7 @@ def table_perf_comparison(table, input_data): # Generate csv tables: csv_file = f"{table[u'output-file']}.csv" - with open(csv_file, u"w") as file_handler: + with open(csv_file, u"wt") as file_handler: file_handler.write(header_str) for test in tbl_lst: file_handler.write(u",".join([str(item) for item in test]) + u"\n") @@ -857,7 +857,7 @@ def table_perf_comparison_nic(table, input_data): # Generate csv tables: csv_file = f"{table[u'output-file']}.csv" - with open(csv_file, u"w") as file_handler: + with open(csv_file, u"wt") as file_handler: file_handler.write(header_str) for test in tbl_lst: file_handler.write(u",".join([str(item) for item in test]) + u"\n") @@ -983,7 +983,7 @@ def table_nics_comparison(table, input_data): tbl_lst.sort(key=lambda rel: rel[-1], reverse=True) # Generate csv tables: - with open(f"{table[u'output-file']}.csv", u"w") as file_handler: + with open(f"{table[u'output-file']}.csv", u"wt") as file_handler: file_handler.write(u",".join(header) + u"\n") for test in tbl_lst: file_handler.write(u",".join([str(item) for item in test]) + u"\n") @@ -1117,7 +1117,7 @@ def table_soak_vs_ndr(table, input_data): # Generate csv tables: csv_file = f"{table[u'output-file']}.csv" - with open(csv_file, u"w") as file_handler: + with open(csv_file, u"wt") as file_handler: file_handler.write(header_str) for test in tbl_lst: file_handler.write(u",".join([str(item) for item in test]) + u"\n") @@ -1240,7 +1240,7 @@ def table_perf_trending_dash(table, input_data): file_name = f"{table[u'output-file']}{table[u'output-file-ext']}" logging.info(f" Writing file: {file_name}") - with open(file_name, u"w") as file_handler: + with open(file_name, u"wt") as file_handler: file_handler.write(header_str) for test in tbl_sorted: file_handler.write(u",".join([str(item) for item in test]) + u'\n') @@ -1548,7 +1548,7 @@ def table_last_failed_tests(table, input_data): file_name = f"{table[u'output-file']}{table[u'output-file-ext']}" logging.info(f" Writing file: {file_name}") - with open(file_name, u"w") as file_handler: + with open(file_name, u"wt") as file_handler: for test in tbl_list: file_handler.write(test + u'\n') @@ -1653,7 +1653,7 @@ def table_failed_tests(table, input_data): file_name = f"{table[u'output-file']}{table[u'output-file-ext']}" logging.info(f" Writing file: {file_name}") - with open(file_name, u"w") as file_handler: + with open(file_name, u"wt") as file_handler: file_handler.write(u",".join(header) + u"\n") for test in tbl_sorted: file_handler.write(u",".join([str(item) for item in test]) + u'\n') diff --git a/resources/tools/presentation/pal_utils.py b/resources/tools/presentation/pal_utils.py index 5949432340..45fd277048 100644 --- a/resources/tools/presentation/pal_utils.py +++ b/resources/tools/presentation/pal_utils.py @@ -316,5 +316,5 @@ def convert_csv_to_pretty_txt(csv_file_name, txt_file_name): txt_table.add_row(row) txt_table.align[u"Test case"] = u"l" if txt_table: - with open(txt_file_name, u"w") as txt_file: + with open(txt_file_name, u"wt") as txt_file: txt_file.write(str(txt_table)) diff --git a/resources/tools/scripts/topo_reservation.py b/resources/tools/scripts/topo_reservation.py index 73f6d0e815..e0f39c76e9 100755 --- a/resources/tools/scripts/topo_reservation.py +++ b/resources/tools/scripts/topo_reservation.py @@ -84,7 +84,7 @@ def main(): ) args = parser.parse_args() - with open(args.topo, "r") as topo_file: + with open(args.topo, u"rt") as topo_file: topology = yaml.safe_load(topo_file.read())[u"nodes"] # Even if TG is not guaranteed to be a Linux host, diff --git a/resources/tools/topology/update_topology.py b/resources/tools/topology/update_topology.py index 4ba3a833d0..37d64b1a05 100755 --- a/resources/tools/topology/update_topology.py +++ b/resources/tools/topology/update_topology.py @@ -37,7 +37,7 @@ def load_topology(args): :rtype: dict """ data = None - with open(args.topology, "r") as stream: + with open(args.topology, u"rt") as stream: try: data = yaml.safe_load(stream) except yaml.YAMLError as exc: @@ -153,7 +153,7 @@ def dump_updated_topology(topology, args): f"overwrite this file, add -f as a parameter to this script" ) return 1 - with open(args.output_file, "w") as stream: + with open(args.output_file, u"wt") as stream: yaml.dump(topology, stream, default_flow_style=False) else: print(yaml.dump(topology, default_flow_style=False)) diff --git a/resources/tools/wrk/wrk_traffic_profile_parser.py b/resources/tools/wrk/wrk_traffic_profile_parser.py index f59210350b..f553465705 100644 --- a/resources/tools/wrk/wrk_traffic_profile_parser.py +++ b/resources/tools/wrk/wrk_traffic_profile_parser.py @@ -61,7 +61,7 @@ class WrkTrafficProfile: self.profile_name = profile_name try: - with open(self.profile_name, "r") as profile_file: + with open(self.profile_name, u"rt") as profile_file: self.traffic_profile = safe_load(profile_file) except IOError as err: raise WrkError( |