From 499142cc08929e4c4d238dac6651007dddac261b Mon Sep 17 00:00:00 2001 From: Julien Muchembled <jm@nexedi.com> Date: Tue, 28 Dec 2010 10:38:47 +0000 Subject: [PATCH] ERP5Type.tests: remove obsolete scripts git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41822 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/tests/run_unit_test | 38 ------------- product/ERP5Type/tests/sendMailToList | 79 --------------------------- 2 files changed, 117 deletions(-) delete mode 100755 product/ERP5Type/tests/run_unit_test delete mode 100755 product/ERP5Type/tests/sendMailToList diff --git a/product/ERP5Type/tests/run_unit_test b/product/ERP5Type/tests/run_unit_test deleted file mode 100755 index 6a98fbfc40..0000000000 --- a/product/ERP5Type/tests/run_unit_test +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -DIRECTORY='/home/seb/zope/Products' -export USER=seb -rm -f $DIRECTORY/../unit_test/tests/zLOG.log -rm -f $DIRECTORY/test_output -touch $DIRECTORY/test_output -rm -f $DIRECTORY/test_full_output -touch $DIRECTORY/test_full_output -$DIRECTORY/update_cvs - -if [ -d ${DIRECTORY}/ERP5/.svn ] -then - svn info ${DIRECTORY}/ERP5 | grep -e '^R.vision[ \t]*:' \ - >> ${DIRECTORY}/test_output -fi - -# Excluded tests must be separated by whitespaces -excluded_test_list="testCatalogSecurity" - -test_list=`/bin/ls -1 $DIRECTORY/*/tests/test*.py` - -for test in $test_list -do - skip_test=0 - test_name=`basename $test .py` - for excluded_test_name in $excluded_test_list - do - [ $test_name = $excluded_test_name ] && skip_test=1 && break - done - [ $skip_test -eq 1 ] && continue - $DIRECTORY/ERP5Type/tests/runUnitTest.py $test_name \ - >> $DIRECTORY/test_full_output 2>&1 -done - -cat $DIRECTORY/test_full_output | grep '\(^OK\|^FAILED\|^Ran\)' | \ - sed "/^FAILED.*\|^OK.*/s/.*/\0\n/g" >> $DIRECTORY/test_output - -$DIRECTORY/sendMailToList diff --git a/product/ERP5Type/tests/sendMailToList b/product/ERP5Type/tests/sendMailToList deleted file mode 100755 index 0f61a1ff45..0000000000 --- a/product/ERP5Type/tests/sendMailToList +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/python - -"""Parses the output of tests from test_output and test_full_output and sends -an email to a list. -Edit this script to change the recipients. -""" - -import smtplib -import re -import os -from datetime import date -from email.MIMEText import MIMEText -from email.MIMEBase import MIMEBase -from email.MIMEImage import MIMEImage -from email.MIMEMultipart import MIMEMultipart - -# configure this part if needed -from_mail = 'nobody@erp5.org' -to_mail = [ 'erp5-report@erp5.org' ] -INSTANCE_HOME = os.environ.get('INSTANCE_HOME', '/var/lib/zope') - -test_msg = file( - os.path.join(INSTANCE_HOME, "Products", "test_output"), 'r').read() -test_msg = "Date : %s\n\n" % date.today().isoformat() + test_msg - -# minimal parsing -revision_re = re.compile('Revision: (?P<revision>\d+)') -ran_test_re = re.compile('Ran (?P<tests>\d+) tests') -errors_re = re.compile('FAILED \((failures=(?P<failures>\d+))*[, ]*'\ - '(errors=(?P<errors>\d+))*\)') -svn_revision = "?" -test_runs = 0 -errors = 0 -failures = 0 -for test_line in test_msg.splitlines(): - revision = revision_re.match(test_line) - if revision: - svn_revision = revision.groupdict()['revision'] - ran = ran_test_re.match(test_line) - if ran: - test_runs += int(ran.groupdict()['tests']) - errors_or_failures = errors_re.match(test_line) - if errors_or_failures: - failures += int(errors_or_failures.groupdict()['failures'] or 0) - errors += int(errors_or_failures.groupdict()['errors'] or 0) - -subject = "ERP5 r%s: %s Tests, %s Errors, %s Failures" % ( - svn_revision, test_runs, errors, failures) - -msg = MIMEMultipart() -msg['Subject'] = subject -msg['From'] = from_mail -msg['To'] = ', '.join(to_mail) -# Add custom headers for client side filtering -msg['X-ERP5-Tests'] = 'ERP5' -if not (failures + errors): - msg['X-ERP5-Tests-Status'] = 'OK' - -# Guarantees the message ends in a newline -msg.preamble = subject -msg.epilogue = '' -file_content = file( - os.path.join(INSTANCE_HOME, "Products", "test_full_output"), 'r').read() - -mime_text = MIMEText(test_msg) -mime_text.add_header('Content-Disposition', 'attachment', - filename='test_output.txt') -msg.attach(mime_text) -mime_text = MIMEText(file_content) -mime_text.add_header('Content-Disposition', 'attachment', - filename='test_full_output.txt') -msg.attach(mime_text) - -# Send the email via our own SMTP server. -s = smtplib.SMTP() -s.connect() -s.sendmail(from_mail, to_mail, msg.as_string()) -s.close() - -- 2.30.9