Author: jvloothuis
Date: Sun Feb 18 13:55:44 2007
New Revision: 39152
Modified:
kukit/kss.buildout/trunk/dotests.py
kukit/kss.buildout/trunk/tests
Log:
Improved code of dotests by using subprocess
Made the testrunner accept a different Python installation
Modified: kukit/kss.buildout/trunk/dotests.py
==============================================================================
--- kukit/kss.buildout/trunk/dotests.py (original)
+++ kukit/kss.buildout/trunk/dotests.py Sun Feb 18 13:55:44 2007
@@ -10,7 +10,7 @@
javapid = subprocess.Popen([java, '-jar', seleniumjar]).pid
#start zope
-zope = os.path.join(here, 'parts', 'instance', 'bin', 'zopectl')
+zope = os.path.join(here, 'bin', 'instance')
subprocess.call([zope, 'start'])
#wait for zope instance to come up
@@ -29,17 +29,26 @@
#start tests
python = sys.executable
+
+env = {
+ 'SELENIUMBROWSER': seleniumbrowser,
+ 'PYTHON': python,
+}
zope_test = os.path.join(here, 'tests')
-test_command_pieces = ['SELENIUMBROWSER="%s"'% seleniumbrowser]
-test_command_pieces.append(zope_test)
-test_command_pieces.append('--package-path')
-test_command_pieces.append(os.path.join(here, 'src', 'kss.demo', 'kss',
'demo', 'tests'))
-test_command_pieces.append('kss.demo.tests --test-file-pattern=^seltest
--tests-pattern=selenium_tests')
-test_command = ' '.join(test_command_pieces)
-print test_command
-std = os.popen(test_command)
-print std.read()
-test_exit = std.close()
+kssdemotests = os.path.join(here, 'src', 'kss.demo', 'kss', 'demo', 'tests')
+command = [zope_test, '--package-path', kssdemotests, 'kss.demo.tests',
+ '--test-file-pattern=^seltest', '--tests-pattern=selenium_tests']
+
+testrunner = subprocess.Popen(command,
+ env=env,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ stdin=subprocess.PIPE,
+ )
+testrunner.wait()
+print testrunner.stdout.read()
+print testrunner.stderr.read()
+test_exit = testrunner.returncode
#stop seleniumRC server
os.kill(javapid, signal.SIGKILL)
@@ -47,4 +56,5 @@
#stop zope
subprocess.call([zope, 'stop'])
+print "Exit code", test_exit
sys.exit(test_exit)
Modified: kukit/kss.buildout/trunk/tests
==============================================================================
--- kukit/kss.buildout/trunk/tests (original)
+++ kukit/kss.buildout/trunk/tests Sun Feb 18 13:55:44 2007
@@ -1,13 +1,11 @@
-#! /bin/sh
-#SELENIUMBROWSER="*firefox /usr/lib/firefox/firefox-bin"
+#!/bin/bash
HERE=`pwd`
-PYTHON="/usr/bin/python2.4"
ZOPE_HOME="$HERE/parts/zope2"
INSTANCE_HOME="$HEREUsers/parts/instance"
CONFIG_FILE="$HERE/parts/instance/etc/zope.conf"
SOFTWARE_HOME="$HERE/parts/zope2/lib/python"
PYTHONPATH="$SOFTWARE_HOME:$HERE/kss.selenium/src/kss.core:$HERE/eggs/setuptools-0.6c5-py2.4.egg:$HERE/src/kss.demo:$PYTHONPATH"
-export PYTHONPATH INSTANCE_HOME SOFTWARE_HOME SELENIUMBROWSER
+export PYTHONPATH INSTANCE_HOME SOFTWARE_HOME
ZOPETEST="$ZOPE_HOME/test.py"
if exec "$PYTHON" "$ZOPETEST" --config-file "$CONFIG_FILE" "$@"; then
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins