@@ -364,8 +364,8 @@ def start(self):
364364 with request .urlopen ('http://127.0.0.1:{}' .format (self .port ), timeout = 3 ) as f :
365365 if f .status != 200 :
366366 raise RuntimeError ()
367- except :
368- raise RuntimeError ('Failed to run the HTTP server' )
367+ except Exception as e :
368+ raise RuntimeError ('Failed to run the HTTP server: {}' . format ( e ) )
369369 log .info ('The HTTP server started' )
370370
371371 def stop (self ):
@@ -504,8 +504,8 @@ def run(self):
504504 except subprocess .TimeoutExpired :
505505 self .subprocess .kill ()
506506 output = self .subprocess .communicate ()
507- except :
508- raise RuntimeError ('Failed to execute: {}' .format (self .args ))
507+ except Exception as e :
508+ raise RuntimeError ('Failed to execute {} : {}' .format (self .args , e ))
509509 output = [i or b'' for i in output ]
510510 output = [i .rstrip (b'\r \n ' ).rstrip (b'\n ' ) for i in output ] # Remove the last line break of the output
511511
@@ -556,7 +556,7 @@ def __str__(self):
556556 def __add__ (self , other ):
557557 if isinstance (other , Executer ):
558558 other = other .stdout
559- if other != None :
559+ if other is not None :
560560 self .lines .append (str (other ))
561561 return self
562562
@@ -605,7 +605,7 @@ def copyTest(num, src, good):
605605 src_file = os .path .join (Config .data_dir , src )
606606 good_file = os .path .join (Config .data_dir , '{}.c{}gd' .format (good , num ))
607607 copyTestFile (good , test_file )
608- Executer ('metacopy -a {src_file } {test_file}' , vars ())
608+ Executer ('metacopy -a {} {}' . format ( src_file , test_file ) , vars ())
609609 return diffCheck (good_file , test_file , in_bytes = True )
610610
611611
@@ -614,7 +614,7 @@ def iptcTest(num, src, good):
614614 src_file = os .path .join (Config .data_dir , src )
615615 good_file = os .path .join (Config .data_dir , '{}.i{}gd' .format (good , num ))
616616 copyTestFile (good , test_file )
617- Executer ('metacopy -ip {src_file } {test_file}' , vars ())
617+ Executer ('metacopy -ip {} {}' . format ( src_file , test_file ) , vars ())
618618 return diffCheck (good_file , test_file , in_bytes = True )
619619
620620
@@ -624,7 +624,7 @@ def printTest(filename):
624624 good_file = os .path .join (Config .data_dir , filename + '.ipgd' )
625625 copyTestFile (filename , test_file )
626626
627- e = Executer ('iptcprint {src_file}' , vars (), assert_returncode = None , decode_output = False )
627+ e = Executer ('iptcprint {}' . format ( src_file ) , vars (), assert_returncode = None , decode_output = False )
628628 stdout = e .stdout .replace (Config .data_dir .replace (os .path .sep , '/' ).encode (), b'../data' ) # Ignore the difference of data_dir on Windows
629629 save (stdout + b'\n ' , test_file )
630630
@@ -743,8 +743,8 @@ def runTest(cmd,raw=False):
743743 print ('{} returncode = {}' .format (cmd , p .returncode ))
744744 # Split the output by newline
745745 out = stdout .decode ('utf-8' ).replace ('\r ' , '' ).rstrip ('\n ' ).split ('\n ' )
746- except :
747- print ('** {} died **' .format (cmd ))
746+ except Exception as e :
747+ print ('** {} died: {} **' .format (cmd , e ))
748748
749749 return out
750750
0 commit comments