[Erp5-report] r42828 jm - /erp5/trunk/products/ERP5/bin/run_test_suite
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Jan 31 15:19:50 CET 2011
Author: jm
Date: Mon Jan 31 15:19:50 2011
New Revision: 42828
URL: http://svn.erp5.org?rev=42828&view=rev
Log:
run_test_suite: add dumb offline mode for testing purpose
Modified:
erp5/trunk/products/ERP5/bin/run_test_suite
Modified: erp5/trunk/products/ERP5/bin/run_test_suite
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bin/run_test_suite?rev=42828&r1=42827&r2=42828&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bin/run_test_suite [utf8] (original)
+++ erp5/trunk/products/ERP5/bin/run_test_suite [utf8] Mon Jan 31 15:19:50 2011
@@ -347,6 +347,29 @@ for var in SubprocessError, TestSuite, E
setattr(module, var.__name__, var)
+class DummyTaskDistributionTool(object):
+
+ def __init__(self):
+ self.lock = threading.Lock()
+
+ def createTestResult(self, name, revision, test_name_list, allow_restart):
+ self.test_name_list = list(test_name_list)
+ return None, revision
+
+ def startUnitTest(self, test_result_path, exclude_list=()):
+ self.lock.acquire()
+ try:
+ for i, test in enumerate(self.test_name_list):
+ if test not in exclude_list:
+ del self.test_name_list[i]
+ return None, test
+ finally:
+ self.lock.release()
+
+ def stopUnitTest(self, test_path, status_dict):
+ pass
+
+
def safeRpcCall(function, *args):
retry = 64
while True:
@@ -400,7 +423,8 @@ def main():
def makeSuite(revision=None):
updater = Updater(revision)
- updater.checkout('tests')
+ if portal_url:
+ updater.checkout('tests')
for k in sys.modules.keys():
if k == 'tests' or k.startswith('tests.'):
del sys.modules[k]
@@ -416,15 +440,19 @@ def main():
suite = suite_class(revision=updater.revision,
max_instance_count=max_instance_count,
mysql_db_list=db_list[:suite_class.mysql_db_count])
- suite.update()
+ if portal_url:
+ suite.update()
return suite
portal_url = options.master
- if portal_url[-1] != '/':
- portal_url += '/'
- portal = xmlrpclib.ServerProxy(portal_url, allow_none=1)
- master = portal.portal_task_distribution
- assert master.getProtocolRevision() == 1
+ if portal_url:
+ if portal_url[-1] != '/':
+ portal_url += '/'
+ portal = xmlrpclib.ServerProxy(portal_url, allow_none=1)
+ master = portal.portal_task_distribution
+ assert master.getProtocolRevision() == 1
+ else:
+ master = DummyTaskDistributionTool()
suite = makeSuite()
revision = suite.getRevision()
@@ -432,9 +460,10 @@ def main():
name, revision, suite.getTestList(), suite.allow_restart)
if test_result:
test_result_path, test_revision = test_result
- url_parts = list(urlparse.urlparse(portal_url + test_result_path))
- url_parts[1] = url_parts[1].split('@')[-1]
- print 'ERP5_TEST_URL %s OK' % urlparse.urlunparse(url_parts) # for buildbot
+ if portal_url: # for buildbot
+ url_parts = list(urlparse.urlparse(portal_url + test_result_path))
+ url_parts[1] = url_parts[1].split('@')[-1]
+ print 'ERP5_TEST_URL %s OK' % urlparse.urlunparse(url_parts)
while suite.acquire():
test = safeRpcCall(master.startUnitTest, test_result_path,
suite.running.keys())
More information about the Erp5-report
mailing list