[Erp5-report] r40552 luke - /erp5/trunk/utils/erp5.appliance.test/src/test.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Nov 23 17:26:27 CET 2010
Author: luke
Date: Tue Nov 23 17:26:26 2010
New Revision: 40552
URL: http://svn.erp5.org?rev=40552&view=rev
Log:
- begin work on Zope 2.8 flavour of test (raises NotImplementedError for now)
Modified:
erp5/trunk/utils/erp5.appliance.test/src/test.py
Modified: erp5/trunk/utils/erp5.appliance.test/src/test.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.appliance.test/src/test.py?rev=40552&r1=40551&r2=40552&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.appliance.test/src/test.py [utf8] (original)
+++ erp5/trunk/utils/erp5.appliance.test/src/test.py [utf8] Tue Nov 23 17:26:26 2010
@@ -321,6 +321,80 @@ def callWithTimeout(command_list, config
raise SubFailed
return returncode
+def run_once28(config, software_path, instance_path,
+ previous_software_revision=-1):
+ status = False
+ begin = time.time()
+ # Checkout/update public buildout repository
+ if os.path.isdir(software_path):
+ checkout_command = [
+ 'svn', 'up', '--non-interactive', '--trust-server-cert',
+ software_path]
+ else:
+ checkout_command = [
+ 'svn', 'co', '--non-interactive', '--trust-server-cert',
+ 'https://svn.erp5.org/repos/public/erp5/trunk/buildout/',
+ software_path]
+ callWithTimeout(checkout_command, config)
+
+ # Do not continue if unneeded
+ revision = detectRevision(config, software_path)
+ if revision == previous_software_revision:
+ return
+ # Configure ERP5 test reporting handler
+ erp5_handler = None
+ if config.erp5_log is not None:
+ config.logger.debug('Configuring external logging system.')
+ erp5_handler = ERP5TestReportHandler(config.erp5_log,
+ getMachineIdString(config), "ERP5Appliance28")
+ config.logger.addHandler(erp5_handler)
+ erp5_handler.revision = revision
+ exc_info = None
+ try:
+ # Bootstrap buildout
+ bootstrap_command = [config.python, '-S', 'bootstrap/bootstrap.py',
+ '-v', '1.4.4']
+ callWithTimeout(bootstrap_command, config, timeout=600, cwd=software_path)
+
+ # Install software
+ buildout_command = [config.python, '-S', '%s/bin/buildout' % software_path]
+ if config.verbose is True:
+ buildout_command.append('-v')
+ callWithTimeout(buildout_command, config, timeout=14400, cwd=software_path)
+
+ # Assert software
+ assert_command = [os.path.join(software_path, 'bin', 'python2.4'),
+ os.path.join('tests', 'assertSoftware.py')]
+ callWithTimeout(assert_command, config, timeout=1800, cwd=software_path)
+
+ # Create instance place
+ if not os.path.exists(instance_path):
+ mkdir = ['mkdir', instance_path]
+ callWithTimeout(mkdir, config)
+ raise NotImplementedError
+ except SubFailed:
+ pass
+ except:
+ exc_info = sys.exc_info()
+ raise
+ else:
+ status = True
+ finally:
+ if exc_info is not None:
+ config.logger.warning('Test stopped with exception:\n', exc_info=exc_info)
+ ran_trick_list = ["------------------------------------------------------"
+ "----------------"]
+ a = ran_trick_list.append
+ a('Ran 1 test in %.2fs' % (time.time() - begin,))
+ if status:
+ a('OK')
+ else:
+ a('FAILED (failures=1)')
+ if erp5_handler is not None:
+ erp5_handler.ran_trick = '\n'.join(ran_trick_list)
+ erp5_handler.close()
+ config.logger.removeHandler(erp5_handler)
+
def run_once212(config, software_path, instance_path,
previous_software_revision=-1):
status = False
@@ -644,7 +718,31 @@ def mainex212():
def main28():
"""Test ERP5 Appliance for 2.8 with full checkout."""
- raise NotImplementedError
+ usage = "usage: %s [options] RUN_DIRECTORY" % sys.argv[0]
+
+ try:
+ # Parse arguments
+ config = Config()
+ config.setConfig(*Parser(usage=usage).check_args())
+ if config.config is not None:
+ if not os.path.exists(config.config):
+ raise ValueError("Configuration file %r cannot be found." %
+ config.config)
+ else:
+ file_config = ConfigParser.SafeConfigParser()
+ file_config.read(config.config)
+ file_config = dict(file_config.items(CONFIG_SECTION))
+ for k,v in file_config.iteritems():
+ if getattr(config, k) is None:
+ setattr(config, k, v)
+
+ run(config, run_once28)
+ return_code = 0
+ except SystemExit, err:
+ # Catch exception raise by optparse
+ return_code = err
+
+ sys.exit(return_code)
def mainex28():
"""Test ERP5 Appliance for 2.8 with buildout extends."""
More information about the Erp5-report
mailing list