@@ -106,10 +106,10 @@ def collect_tox_coverage_files(targeted_packages):
106
106
shutil .move (source , dest )
107
107
108
108
109
- def individual_workload (tox_command_tuple , failed_workload_results ):
109
+ def individual_workload (tox_command_tuple , workload_results ):
110
+ pkg = os .path .basename (tox_command_tuple [1 ])
110
111
stdout = os .path .join (tox_command_tuple [1 ], "stdout.txt" )
111
112
stderr = os .path .join (tox_command_tuple [1 ], "stderr.txt" )
112
- pkg = os .path .basename (tox_command_tuple [1 ])
113
113
tox_dir = os .path .join (tox_command_tuple [1 ], './.tox/' )
114
114
115
115
with open (stdout , "w" ) as f_stdout , open (stderr , "w" ) as f_stderr :
@@ -124,16 +124,18 @@ def individual_workload(tox_command_tuple, failed_workload_results):
124
124
logging .info ("POpened task for for {}" .format (pkg ))
125
125
proc .wait ()
126
126
127
- log_file ( stdout )
128
-
127
+ return_code = proc . returncode
128
+
129
129
if proc .returncode != 0 :
130
130
logging .error ("{} returned with code {}" .format (pkg , proc .returncode ))
131
- failed_workload_results [pkg ] = proc .returncode
131
+ else :
132
+ logging .info ("{} returned with code 0, output will be printed after the test run completes." .format (pkg ))
132
133
133
134
if read_file (stderr ):
134
135
logging .error ("Package {} had stderror output. Logging." .format (pkg ))
135
- failed_workload_results [pkg ] = "StdErr output detected"
136
- log_file (stderr )
136
+ return_code = "StdErr output detected"
137
+
138
+ workload_results [tox_command_tuple [1 ]] = (return_code , stdout , stderr )
137
139
138
140
if in_ci ():
139
141
shutil .rmtree (tox_dir )
@@ -143,22 +145,27 @@ def individual_workload(tox_command_tuple, failed_workload_results):
143
145
144
146
def execute_tox_parallel (tox_command_tuples ):
145
147
pool = ThreadPool (pool_size )
146
- failed_workload_results = {}
148
+ workload_results = {}
147
149
148
150
for index , cmd_tuple in enumerate (tox_command_tuples ):
149
- pool .add_task (individual_workload , cmd_tuple , failed_workload_results )
151
+ pool .add_task (individual_workload , cmd_tuple , workload_results )
150
152
151
153
pool .wait_completion ()
152
154
153
- if len (failed_workload_results .keys ()):
154
- for key in failed_workload_results .keys ():
155
+ failed_run = False
156
+
157
+ for key in workload_results .keys ():
158
+ log_file (workload_results [key ][1 ])
159
+
160
+ if workload_results [key ][0 ] != 0 :
155
161
logging .error (
156
162
"{} tox invocation exited with returncode {}" .format (
157
- key , failed_workload_results [key ]
163
+ os . path . basename ( key ), workload_results [key ]
158
164
)
159
165
)
160
- exit (1 )
161
166
167
+ if failed_run :
168
+ exit (1 )
162
169
163
170
def execute_tox_serial (tox_command_tuples ):
164
171
for index , cmd_tuple in enumerate (tox_command_tuples ):
@@ -218,7 +225,6 @@ def prep_and_run_tox(targeted_packages, parsed_args, options_array=[]):
218
225
if local_options_array :
219
226
tox_execution_array .extend (["--" ] + local_options_array )
220
227
221
- # 0 = command array
222
228
tox_command_tuples .append ((tox_execution_array , package_dir ))
223
229
224
230
if parsed_args .tparallel :
0 commit comments