Commit 9099b32d authored by Rafael Monnerat's avatar Rafael Monnerat

introduce --email_subject to Custom the initial part of email subject.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30430 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6f8e1609
...@@ -31,9 +31,10 @@ Options: ...@@ -31,9 +31,10 @@ Options:
URLs will start with: URLs will start with:
http://${host}:${port}/${portal_name}/ http://${host}:${port}/${portal_name}/
--run_only=STRING run only specified test suite (should be only one) --run_only=STRING run only specified test suite (should be only one)
--email_subject the email subject to be sent
Notes: Notes:
* You need to prepepare first test environment by using following command: * You need to prepepare first test environment by using following command:
./runUnitTest.py --save prepareFunctionalTest.py ./runUnitTest.py --save prepareFunctionalTest.py
""" """
...@@ -47,6 +48,7 @@ stdout = 0 ...@@ -47,6 +48,7 @@ stdout = 0
debug = 0 debug = 0
email_to_address = 'erp5-report@erp5.org' email_to_address = 'erp5-report@erp5.org'
smtp_host = '' smtp_host = ''
email_subject = 'ERP5'
run_only='' run_only=''
tests_framework_home = os.path.dirname(os.path.abspath(__file__)) tests_framework_home = os.path.dirname(os.path.abspath(__file__))
...@@ -83,11 +85,13 @@ def parseArgs(): ...@@ -83,11 +85,13 @@ def parseArgs():
global portal_name global portal_name
global portal_url global portal_url
global run_only global run_only
global email_subject
try: try:
opts, args = getopt.getopt(sys.argv[1:], opts, args = getopt.getopt(sys.argv[1:],
"hsd", ["help", "stdout", "debug", "hsd", ["help", "stdout", "debug",
"email_to_address=", "host=", "port=", "portal_name=", "run_only=", "email_to_address=", "host=", "port=",
"smtp_host="] ) "portal_name=", "run_only=",
"email_subject=", "smtp_host="] )
except getopt.GetoptError, msg: except getopt.GetoptError, msg:
usage(sys.stderr, msg) usage(sys.stderr, msg)
sys.exit(2) sys.exit(2)
...@@ -113,6 +117,8 @@ def parseArgs(): ...@@ -113,6 +117,8 @@ def parseArgs():
portal_name = arg portal_name = arg
elif opt == "--run_only": elif opt == "--run_only":
run_only = arg run_only = arg
elif opt == "--email_subject":
email_subject = arg
if not stdout: if not stdout:
send_mail = 1 send_mail = 1
...@@ -248,6 +254,7 @@ def unsubscribeFromTimerService(): ...@@ -248,6 +254,7 @@ def unsubscribeFromTimerService():
(portal_url, user, password)) (portal_url, user, password))
def sendResult(): def sendResult():
global email_subject
result_uri = urllib2.urlopen('%s/portal_tests/TestTool_getResults' % portal_url).readline() result_uri = urllib2.urlopen('%s/portal_tests/TestTool_getResults' % portal_url).readline()
print result_uri print result_uri
file_content = urllib2.urlopen(result_uri).read() file_content = urllib2.urlopen(result_uri).read()
...@@ -258,7 +265,6 @@ def sendResult(): ...@@ -258,7 +265,6 @@ def sendResult():
result_re = re.compile('<div style="padding-top: 10px;">\s*<p>\s*' result_re = re.compile('<div style="padding-top: 10px;">\s*<p>\s*'
'<img.*?</div>\s.*?</div>\s*', re.S) '<img.*?</div>\s.*?</div>\s*', re.S)
error_result_re = re.compile('.*(?:error.gif|title status_failed).*', re.S) error_result_re = re.compile('.*(?:error.gif|title status_failed).*', re.S)
passes = passes_re.search(file_content).group(1) passes = passes_re.search(file_content).group(1)
failures = failures_re.search(file_content).group(1) failures = failures_re.search(file_content).group(1)
error_titles = [re.compile('\s+').sub(' ', x).strip() error_titles = [re.compile('\s+').sub(' ', x).strip()
...@@ -266,8 +272,8 @@ def sendResult(): ...@@ -266,8 +272,8 @@ def sendResult():
os.chdir('%s/Products/ERP5' % instance_home) os.chdir('%s/Products/ERP5' % instance_home)
revision = pysvn.Client().info('.').revision.number revision = pysvn.Client().info('.').revision.number
subject = "ERP5 r%s: Functional Tests, %s Passes, %s Failures" \ subject = "%s r%s: Functional Tests, %s Passes, %s Failures" \
% (revision, passes, failures) % (email_subject, revision, passes, failures)
summary = """ summary = """
Test Summary Test Summary
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment