Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d6db83f

Browse files
committed
Send an email also when regression test is successful
1 parent f970b4f commit d6db83f

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

extra/shutils/regressiontest.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
3131
3232
33-
SUBJECT = "Regression test on %s using revision %s" % (START_TIME, REVISION)
33+
SUBJECT = "regression test started on %s using revision %s" % (START_TIME, REVISION)
3434

3535
def prepare_email(content):
3636
global FROM
@@ -132,9 +132,11 @@ def main():
132132

133133
content += "#######################################################################\n\n"
134134

135+
end_string = "Regression test finished at %s" % time.strftime("%H:%M:%S %d-%m-%Y", time.gmtime())
136+
135137
if content:
136-
content += "Regression test finished at %s" % time.strftime("%H:%M:%S %d-%m-%Y", time.gmtime())
137-
SUBJECT += " (%s)" % ", ".join("#%d" % count for count in test_counts)
138+
content += end_string
139+
SUBJECT = "Failed %s (%s)" % (SUBJECT, ", ".join("#%d" % count for count in test_counts))
138140

139141
msg = prepare_email(content)
140142

@@ -144,6 +146,10 @@ def main():
144146
msg.attach(attachment)
145147

146148
send_email(msg)
149+
else:
150+
SUBJECT += "Successful %s" % SUBJECT
151+
msg = prepare_email("All test cases were successful\n\n%s" % end_string)
152+
send_email(msg)
147153

148154
if __name__ == "__main__":
149155
log_fd = open("/tmp/sqlmapregressiontest.log", "wb")

0 commit comments

Comments
 (0)