@@ -196,6 +196,16 @@ def _github_action_log(message: str) -> None:
196
196
print (f"\n { message } " , flush = True )
197
197
198
198
199
+ def _print (message : str ) -> None :
200
+ """Print a message and flush.
201
+
202
+ This ensures the message doesn't get buffered and mixed in the test stdout
203
+
204
+ :param message: The message
205
+ """
206
+ print (f"\n { message } " , flush = True )
207
+
208
+
199
209
@pytest .fixture (scope = "session" , name = "appliance_dhcp_address" )
200
210
def _appliance_dhcp_address (env_vars : Dict [str , str ]) -> Generator [str , None , None ]:
201
211
"""Build the lab and collect the appliance DHCP address.
@@ -206,7 +216,7 @@ def _appliance_dhcp_address(env_vars: Dict[str, str]) -> Generator[str, None, No
206
216
"""
207
217
_github_action_log ("::group::Starting lab provisioning" )
208
218
209
- logger . info ("Starting lab provisioning" )
219
+ _print ("Starting lab provisioning" )
210
220
211
221
try :
212
222
@@ -240,7 +250,7 @@ def _appliance_dhcp_address(env_vars: Dict[str, str]) -> Generator[str, None, No
240
250
raise Exception ("Failed to get DHCP lease for the appliance" ) from exc
241
251
242
252
end = time .time ()
243
- logger . info ( "Elapsed time to provision %s seconds" , end - start )
253
+ _print ( f "Elapsed time to provision { end - start } seconds" )
244
254
245
255
except Exception as exc :
246
256
logger .error ("Failed to provision lab" )
@@ -293,8 +303,8 @@ def ansible_project(
293
303
playbook_path = tmp_path / "site.json"
294
304
with playbook_path .open (mode = "w" , encoding = "utf-8" ) as fh :
295
305
json .dump (playbook_contents , fh )
296
- logger . info ( "Inventory path: %s" , inventory_path )
297
- logger . info ( "Playbook path: %s" , playbook_path )
306
+ _print ( f "Inventory path: { inventory_path } " )
307
+ _print ( f "Playbook path: { playbook_path } " )
298
308
299
309
return AnsibleProject (
300
310
playbook = playbook_path ,
0 commit comments