def __init__(self): cpu_count = os.sysconf("SC_NPROCESSORS_ONLN") self.threads_num = cpu_count * 4 self.options = None self._colors = dict(black=0, red=1, green=2, yellow=3, blue=4, Magenta=5, cyan=6, white=7) self.test_run = False self.env = get_env("server.conf")
def __init__(self,filename): self.env = get_env(filename) self.resourceQueue = []#Queue.Queue(0) self.resultQueue = []#Queue.Queue(0) print self.env.config.resources.keys() for i in self.env.config.resources.keys(): if self.env.config.resources[i].rtype == "http": self.resourceQueue.append(HttpResource(self.env.config.resources[i]))
def __init__(self, filename): self.env = get_env(filename) self.resourceQueue = [] #Queue.Queue(0) self.resultQueue = [] #Queue.Queue(0) print self.env.config.resources.keys() for i in self.env.config.resources.keys(): if self.env.config.resources[i].rtype == "http": self.resourceQueue.append( HttpResource(self.env.config.resources[i]))
def __init__(self): cpu_count = os.sysconf('SC_NPROCESSORS_ONLN') self.threads_num = cpu_count * 4 self.options = None self._colors = dict(black=0, red=1, green=2, yellow=3, blue=4, Magenta=5, cyan=6, white=7) self.test_run = False self.env = get_env('server.conf')
#SystemCurlTests$ python system-test.py import Queue import threading import time import random import os import re import sys import subprocess import tempfile from optparse import OptionParser from pylib.yamlloader import get_env from pylib.sendemail import send_report env = get_env('server.conf') testdir = env.config.mainserver.testdir logfile = env.config.mainserver.logfile htmlfile = env.config.mainserver.htmlfile curl_http_v = env.config.mainserver.curl.curl_http_v curl_cookie_save = env.config.mainserver.curl.cookie_save curl_cookie_use = env.config.mainserver.curl.cookie_use curl_content_type = env.config.mainserver.curl.content_type curl_request_type = env.config.mainserver.curl.request_type curl_url = env.config.mainserver.curl.server_url class TestCurlThread(threading.Thread): def __init__(self, index, taskqueue, resultqueue, curl_options=None): self.index = index threading.Thread.__init__(self)
import Queue import threading import time import random import os import re import sys import subprocess import tempfile from optparse import OptionParser from pylib.yamlloader import get_env from pylib.sendemail import send_report env = get_env("server.conf") python = env.config.mainserver.python pythonopt = env.config.mainserver.pythonopt testdir = env.config.mainserver.testdir logfile = env.config.mainserver.logfile htmlfile = env.config.mainserver.htmlfile class TestThread(threading.Thread): def __init__(self, index, taskqueue, resultqueue): self.index = index threading.Thread.__init__(self) self.taskqueue = taskqueue self.resultqueue = resultqueue self._logfilename = None self.cleanup() def logfilename(self):
from email.MIMEMultipart import MIMEMultipart from email.MIMEText import MIMEText import smtplib from pylib.yamlloader import get_env options=get_env('server.conf').config.mainserver def send_report(txtreport, htmlreport): if options.emails is None: return print "sending email to", options.emails try: sender = '*****@*****.**' recipients = options.emails subject = ' system-test results' message = MIMEMultipart('alternative') message['To'] = ', '.join(recipients) message['From'] = sender message['Subject'] = subject # message.preamble = subject message.epilogue = '' p1 = MIMEText(txtreport, 'plain') p2 = MIMEText(htmlreport, 'html') message.attach(p1) message.attach(p2) session = smtplib.SMTP('localhost') session.sendmail(sender, recipients, message.as_string()) session.quit() except smtplib.SMTPException, e: print "Couldn't send report. %s" % e
#SystemCurlTests$ python system-test.py import Queue import threading import time import random import os import re import sys import subprocess import tempfile from optparse import OptionParser from pylib.yamlloader import get_env from pylib.sendemail import send_report env=get_env('server.conf') testdir = env.config.mainserver.testdir logfile = env.config.mainserver.logfile htmlfile = env.config.mainserver.htmlfile curl_http_v = env.config.mainserver.curl.curl_http_v curl_cookie_save = env.config.mainserver.curl.cookie_save curl_cookie_use = env.config.mainserver.curl.cookie_use curl_content_type = env.config.mainserver.curl.content_type curl_request_type = env.config.mainserver.curl.request_type curl_url = env.config.mainserver.curl.server_url class TestCurlThread(threading.Thread): def __init__(self, index, taskqueue, resultqueue, curl_options=None): self.index = index threading.Thread.__init__(self) self.taskqueue = taskqueue
from email.MIMEMultipart import MIMEMultipart from email.MIMEText import MIMEText import smtplib from pylib.yamlloader import get_env options = get_env('server.conf').config.mainserver def send_report(txtreport, htmlreport): if options.emails is None: return print "sending email to", options.emails try: sender = '*****@*****.**' recipients = options.emails subject = ' system-test results' message = MIMEMultipart('alternative') message['To'] = ', '.join(recipients) message['From'] = sender message['Subject'] = subject # message.preamble = subject message.epilogue = '' p1 = MIMEText(txtreport, 'plain') p2 = MIMEText(htmlreport, 'html') message.attach(p1) message.attach(p2) session = smtplib.SMTP('localhost') session.sendmail(sender, recipients, message.as_string()) session.quit() except smtplib.SMTPException, e: print "Couldn't send report. %s" % e