8
8
import logging
9
9
import os
10
10
import shutil
11
+ import urllib .parse
11
12
from typing import Any
12
13
13
14
import yaml
@@ -49,9 +50,9 @@ def _create_base_folder_structure(self, component_name: str, component_test_conf
49
50
return os .path .realpath (dest_directory )
50
51
51
52
def _generate_std_files (self , stdout : str , stderr : str , output_path : str ) -> None :
52
- with open (os .path .join (output_path , "stdout.txt" ), "w" , encoding = ' utf-8' ) as stdout_file :
53
+ with open (os .path .join (output_path , "stdout.txt" ), "w" , encoding = " utf-8" ) as stdout_file :
53
54
stdout_file .write (stdout )
54
- with open (os .path .join (output_path , "stderr.txt" ), "w" , encoding = ' utf-8' ) as stderr_file :
55
+ with open (os .path .join (output_path , "stderr.txt" ), "w" , encoding = " utf-8" ) as stderr_file :
55
56
stderr_file .write (stderr )
56
57
57
58
def _generate_yml (self , test_result_data : TestResultData , output_path : str ) -> str :
@@ -66,14 +67,17 @@ def _generate_yml(self, test_result_data: TestResultData, output_path: str) -> s
66
67
"component_name" : test_result_data .component_name ,
67
68
"test_config" : test_result_data .component_test_config ,
68
69
"test_result" : "PASS" if (test_result_data .exit_code == 0 ) else "FAIL" ,
69
- "test_result_files" : test_result_file
70
+ "test_result_files" : test_result_file ,
70
71
}
71
- with open (os .path .join (output_path , "%s.yml" % test_result_data .component_name ), "w" , encoding = ' utf-8' ) as file :
72
+ with open (os .path .join (output_path , "%s.yml" % test_result_data .component_name ), "w" , encoding = " utf-8" ) as file :
72
73
yaml .dump (outcome , file )
73
74
return os .path .realpath ("%s.yml" % test_result_data .component_name )
74
75
75
76
def _update_absolute_file_paths (self , files : list , base_path : str , relative_path : str ) -> list :
76
- return [os .path .join (base_path , relative_path , file ) for file in files ]
77
+ if base_path .startswith ("https://" ):
78
+ return [f"{ base_path } /{ relative_path } /{ urllib .parse .quote_plus (file )} " for file in files ]
79
+ else :
80
+ return [os .path .join (base_path , relative_path , file ) for file in files ]
77
81
78
82
# get a list of files within directory with relative paths.
79
83
def _get_list_files (self , dir : str ) -> list :
@@ -133,7 +137,7 @@ def save_test_result_data(self, test_result_data: TestResultData) -> None:
133
137
134
138
135
139
class TestResultsLogs (LogRecorder ):
136
- __test__ = False # type:ignore
140
+ __test__ = False # type:ignore
137
141
parent_class : TestRecorder
138
142
139
143
def __init__ (self , parent_class : TestRecorder ) -> None :
0 commit comments