@@ -79,28 +79,28 @@ def execute(args, test, output_log):
7979 output_log .write (f"{ stamp } { string } \n " )
8080
8181 if plan :
82- cprint (pcolor .purple , '{ } {}' . format ( stamp , string ) )
82+ cprint (pcolor .purple , f' { stamp } { string } ' )
8383 test ['plan' ] = plan .group (2 )
8484 elif skip :
85- cprint (pcolor .yellow , '{ } {}' . format ( stamp , string ) )
85+ cprint (pcolor .yellow , f' { stamp } { string } ' )
8686 test ['executed' ] = skip .group (1 )
8787 test_skip = True
8888 elif skip_suite :
89- cprint (pcolor .yellow , '{ } {}' . format ( stamp , string ) )
89+ cprint (pcolor .yellow , f' { stamp } { string } ' )
9090 test ['executed' ] = skip .group (1 )
9191 skip_suite = True
9292 test_skip = True
9393 elif ok :
94- cprint (pcolor .green , '{ } {}' . format ( stamp , string ) )
94+ cprint (pcolor .green , f' { stamp } { string } ' )
9595 test ['executed' ] = ok .group (1 )
9696 elif not_ok :
97- cprint (pcolor .red , '{ } {}' . format ( stamp , string ) )
97+ cprint (pcolor .red , f' { stamp } { string } ' )
9898 err = True
9999 test ['executed' ] = not_ok .group (1 )
100100 elif comment :
101- cprint (pcolor .faint , '{ } {}' . format ( stamp , string ) )
101+ cprint (pcolor .faint , f' { stamp } { string } ' )
102102 else :
103- print ("{ } {}" . format ( stamp , string ) )
103+ print (f" { stamp } { string } " )
104104
105105 out , error = proc .communicate ()
106106 exitcode = proc .returncode
@@ -129,8 +129,7 @@ def run_onfail(args, test):
129129 onfail ['unix_name' ] = 'onfail'
130130 onfail ['name' ] = 'onfail'
131131
132- print ("\n {}Running onfail \" {}\" for test {}{}" . format (pcolor .cyan , test ['onfail' ],
133- test ['name' ], pcolor .reset ))
132+ print (f"\n { pcolor .cyan } Running onfail \" { test ['onfail' ]} \" for test { test ['name' ]} { pcolor .reset } " )
134133
135134 vcprint (pcolor .faint , f"Executing onfail { onfail ['case' ]} for test { test ['case' ]} " )
136135
@@ -175,7 +174,7 @@ def run_test(args, test):
175174 return False , False , True
176175
177176 if test ['plan' ] != test ['executed' ]:
178- print ("test error, not conforming to plan ({}/{})" . format ( test ['executed' ], test ['plan' ]) )
177+ print (f "test error, not conforming to plan ({ test ['executed' ]} / { test ['plan' ]} )" )
179178 err = True
180179
181180 return skip_suite , skip , err
@@ -269,8 +268,8 @@ def parse_suite(suite_path, parent_suite_path, options, settings, name=None):
269268 suite ['name' ] = gen_name (suite_path )
270269
271270 if not os .path .isfile (suite_path ):
272- print ("error, test suite not found {}" . format ( suite_path ) )
273- print ("(referenced from {})" . format ( parent_suite_path ) )
271+ print (f "error, test suite not found { suite_path } " )
272+ print (f "(referenced from { parent_suite_path } )" )
274273 sys .exit (1 )
275274
276275 data = parse_yaml (suite_path )
@@ -335,17 +334,17 @@ def parse_suite(suite_path, parent_suite_path, options, settings, name=None):
335334 vcprint (pcolor .faint , f"No test specification for { case ['case' ]} ({ test_spec_path } )" )
336335
337336 if not os .path .isfile (case ['case' ]):
338- print ("error, test case not found {}" . format ( case ['case' ]) )
339- print ("(referenced from {})" . format ( suite_path ) )
337+ print (f "error, test case not found { case ['case' ]} " )
338+ print (f "(referenced from { suite_path } )" )
340339 sys .exit (1 )
341340 if not os .access (case ['case' ], os .X_OK ):
342- print ("error, test case not executable {}" . format ( case ['case' ]) )
341+ print (f "error, test case not executable { case ['case' ]} " )
343342 sys .exit (1 )
344343 suite ['suite' ].append (case )
345344 elif 'settings' in entry :
346345 pass # Handled by preparser
347346 else :
348- print ("error, missing suite/case/settings in suite {}" . format ( suite ['name' ]) )
347+ print (f "error, missing suite/case/settings in suite { suite ['name' ]} " )
349348 sys .exit (1 )
350349 return suite
351350
@@ -392,7 +391,7 @@ def write_report_output(file, data, depth, is_first=True):
392391
393392 # Skip headnig from test spec.
394393 if 'test-spec' in test :
395- file .write ("include::{}[lines=2..-1]\n " . format ( test [ 'test-spec' ]) )
394+ file .write (f "include::{ test [ 'test-spec' ] } [lines=2..-1]\n " )
396395
397396 # Add test information table
398397 file .write ("\n ==== Test Information\n " )
@@ -537,9 +536,7 @@ def write_github_result_tree(file, data, depth):
537536 }
538537 for test in data ['suite' ]:
539538 mark = icon_map .get (test ['result' ], "" )
540- file .write ("{}- {} : {} {}\n " .format (' ' * depth , mark ,
541- test ['uniq_id' ],
542- test ['name' ]))
539+ file .write (f"{ ' ' * depth } - { mark } : { test ['uniq_id' ]} { test ['name' ]} \n " )
543540
544541 if 'suite' in test :
545542 write_github_result_tree (file , test , depth + 1 )
@@ -551,10 +548,7 @@ def write_github_result(data):
551548
552549def write_md_result_tree (file , data , depth ):
553550 for test in data ['suite' ]:
554- file .write ("{}- {} : {} {}\n " .format (' ' * depth ,
555- test ['result' ].upper (),
556- test ['uniq_id' ],
557- test ['name' ]))
551+ file .write (f"{ ' ' * depth } - { test ['result' ].upper ()} : { test ['uniq_id' ]} { test ['name' ]} \n " )
558552
559553 if 'suite' in test :
560554 write_md_result_tree (file , test , depth + 1 )
@@ -595,7 +589,7 @@ def print_result_tree(data, base):
595589 sign = "?"
596590 color = pcolor .yellow
597591
598- print ("{}{}{}{ } {} {}{}" . format ( base , prefix , color , sign , test ['uniq_id' ], test ['name' ], pcolor .reset ) )
592+ print (f" { base } { prefix } { color } { sign } { test ['uniq_id' ]} { test ['name' ]} { pcolor .reset } " )
599593
600594 if 'suite' in test :
601595 print_result_tree (test , nextbase )
@@ -632,10 +626,10 @@ def run_suite(args, data, skip_suite):
632626
633627 elif 'case' in test :
634628 if not os .path .isfile (test ['case' ]):
635- print ("error, test case not found {}" . format ( test ['case' ]) )
629+ print (f "error, test case not found { test ['case' ]} " )
636630 sys .exit (1 )
637631 if not os .access (test ['case' ], os .X_OK ):
638- print ("error, test case not executable {}" . format ( test ['case' ]) )
632+ print (f "error, test case not executable { test ['case' ]} " )
639633 sys .exit (1 )
640634
641635 if skip_suite :
@@ -644,7 +638,7 @@ def run_suite(args, data, skip_suite):
644638 skip_suite , subskip , suberr = run_test (args , test )
645639 if suberr :
646640 if 'mask' in test and test ['mask' ] == "fail" :
647- print ("{ }Test failure is masked in suite{}" . format ( pcolor .red , pcolor . reset ) )
641+ print (f" { pcolor . red } Test failure is masked in suite{ pcolor .reset } " )
648642 test ['result' ] = "masked-fail"
649643 err = False
650644 else :
@@ -659,7 +653,7 @@ def run_suite(args, data, skip_suite):
659653 break
660654 elif subskip :
661655 if 'mask' in test and test ['mask' ] == "skip" :
662- print ("{ }Test skip is masked in suite{}" . format ( pcolor .orange , pcolor . reset ) )
656+ print (f" { pcolor . orange } Test skip is masked in suite{ pcolor .reset } " )
663657 test ['result' ] = "masked-skip"
664658 else :
665659 skip = True
@@ -876,7 +870,7 @@ def main():
876870 sha = ""
877871 if (sha := run_git_cmd (ROOT_PATH , ['rev-parse' , 'HEAD' ])):
878872 sha = f"({ sha [:10 ]} )"
879- cprint (pcolor .yellow , "9PM - Simplicity is the ultimate sophistication {}" . format ( sha ) )
873+ cprint (pcolor .yellow , f "9PM - Simplicity is the ultimate sophistication { sha } " )
880874
881875 args = parse_cmdline ()
882876 VERBOSE = args .verbose
0 commit comments