@@ -65,25 +65,22 @@ def send_mail_with_logs(self, identifier):
6565 reports = os .path .join (root_dir , 'reports' )
6666 log_regexp = re .compile ('.+{identifier}.+' .format (identifier = identifier ))
6767
68- try :
69- logfile = sorted ([filename for filename in os .listdir (logs ) if filename not in files_to_ignore and log_regexp .match (filename )], reverse = True )[0 ]
70- logfile_timestamp = re .match (r'(\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2})-.+' , logfile ).group (1 )
71-
72- report_regexp = re .compile ('report_{timestamp}-{identifier}_(\d+)' .format (timestamp = logfile_timestamp , identifier = identifier ))
73- reportfile = sorted ([filename for filename in os .listdir (reports ) if filename not in files_to_ignore and report_regexp .match (filename )], reverse = True )[0 ]
74- changes = report_regexp .match (reportfile ).group (1 )
75-
76- email_date = time .strftime ('%Y-%m-%d %H:%M:%S' )
77-
78- command = [
79- '(echo "Changes since the last time: {changes}";' .format (changes = changes ),
80- 'uuencode "{logs}/{logfile}" "{logfile}";' .format (logs = logs , logfile = logfile ),
81- 'uuencode "{reports}/{reportfile}" "{reportfile}")' .format (reports = reports , reportfile = reportfile ),
82- '| mail -s "Selenium Tests Report: {identifier} {email_date} Changes: {changes}" {email}' .format (identifier = identifier , email_date = email_date , changes = changes , email = self .email )
83- ]
84- self .run_command (command )
85- except :
86- pass
68+ logfile = sorted ([filename for filename in os .listdir (logs ) if filename not in self .files_to_ignore and log_regexp .match (filename )], reverse = True )[0 ]
69+ logfile_timestamp = re .match (r'(\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2})-.+' , logfile ).group (1 )
70+
71+ report_regexp = re .compile ('report_{timestamp}-{identifier}_(\d+)' .format (timestamp = logfile_timestamp , identifier = identifier ))
72+ reportfile = sorted ([filename for filename in os .listdir (reports ) if filename not in self .files_to_ignore and report_regexp .match (filename )], reverse = True )[0 ]
73+ changes = report_regexp .match (reportfile ).group (1 )
74+
75+ email_date = time .strftime ('%Y-%m-%d %H:%M:%S' )
76+
77+ command = [
78+ '(echo "Changes since the last time: {changes}";' .format (changes = changes ),
79+ 'uuencode "{logs}/{logfile}" "{logfile}";' .format (logs = logs , logfile = logfile ),
80+ 'uuencode "{reports}/{reportfile}" "{reportfile}")' .format (reports = reports , reportfile = reportfile ),
81+ '| mail -s "Selenium Tests Report: {identifier} {email_date} Changes: {changes}" {email}' .format (identifier = identifier , email_date = email_date , changes = changes , email = self .email )
82+ ]
83+ self .run_command (command )
8784
8885 def create_command (self , test_directory , * extra_arguments ):
8986 return ['tox' , 'tests/' + test_directory , '--' , '--url={}' .format (TARGETS [self .url ])] + list (extra_arguments )
0 commit comments