Upgraded jstests to use the new django-serv plugin and new token auth
This commit is contained in:
Родитель
0e707b3df7
Коммит
05c30bbefd
|
@ -4,7 +4,7 @@ A wrapper around nosetests to run JavaScript tests in a CI environment.
|
|||
Example::
|
||||
|
||||
python run_jstests.py --with-xunit \
|
||||
--with-zamboni --zamboni-host hudson.mozilla.org \
|
||||
--with-django-serv --django-host hudson.mozilla.org \
|
||||
--with-jstests \
|
||||
--jstests-server http://jstestnet.farmdev.com/ \
|
||||
--jstests-suite zamboni --jstests-browsers firefox
|
||||
|
@ -15,59 +15,16 @@ import site
|
|||
import subprocess
|
||||
|
||||
ROOT = os.path.join(os.path.dirname(__file__), '..')
|
||||
assert 'manage.py' in os.listdir(ROOT), (
|
||||
'Expected this to be the root dir containing manage.py: %s' % ROOT)
|
||||
|
||||
site.addsitedir(os.path.join(ROOT, 'vendor'))
|
||||
site.addsitedir(os.path.join(ROOT, 'vendor/lib/python'))
|
||||
|
||||
from jstestnetlib import webapp
|
||||
from jstestnetlib.noseplugin import JSTests
|
||||
from jstestnetlib.noseplugins import JSTests, DjangoServPlugin
|
||||
import nose
|
||||
from nose.plugins import Plugin
|
||||
|
||||
|
||||
class Zamboni(Plugin):
|
||||
"""Starts/stops Django runserver for tests."""
|
||||
name = 'zamboni'
|
||||
|
||||
def options(self, parser, env=os.environ):
|
||||
super(Zamboni, self).options(parser, env=env)
|
||||
parser.add_option('--zamboni-host', default='0.0.0.0',
|
||||
help='Hostname or IP address to bind manage.py '
|
||||
'runserver to. This must match the host/ip '
|
||||
'configured in your --jstests-suite URL. '
|
||||
'Default: %default')
|
||||
parser.add_option('--zamboni-port', default=9877,
|
||||
help='Port to bind manage.py runserver to. '
|
||||
'This must match the port '
|
||||
'configured in your --jstests-suite URL. '
|
||||
'Default: %default')
|
||||
parser.add_option('--zamboni-log', default=None,
|
||||
help='Log filename for the manage.py runserver '
|
||||
'command. Logs to a temp file by default.')
|
||||
self.parser = parser
|
||||
|
||||
def configure(self, options, conf):
|
||||
super(Zamboni, self).configure(options, conf)
|
||||
self.options = options
|
||||
|
||||
def begin(self):
|
||||
bind = '%s:%s' % (self.options.zamboni_host,
|
||||
self.options.zamboni_port)
|
||||
startup_url = 'http://%s/' % bind
|
||||
self.zamboni = webapp.WebappServerCmd(
|
||||
['python', 'manage.py', 'runserver', bind],
|
||||
startup_url, logfile=self.options.zamboni_log,
|
||||
cwd=ROOT)
|
||||
self.zamboni.startup()
|
||||
|
||||
def finalize(self, result):
|
||||
self.zamboni.shutdown()
|
||||
|
||||
|
||||
def main():
|
||||
nose.main(addplugins=[Zamboni(), JSTests()])
|
||||
nose.main(addplugins=[DjangoServPlugin(ROOT), JSTests()])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -83,8 +83,8 @@ python manage.py syncdb --noinput
|
|||
echo "Starting JS tests..." `date`
|
||||
|
||||
rm $LOG
|
||||
# NOTE: the host value here needs to match the 'zambnoi' suite in jstestnet
|
||||
cd scripts
|
||||
python run_jstests.py -v --with-xunit --with-zamboni --zamboni-host sm-hudson01 --zamboni-log $LOG --with-jstests --jstests-server http://jstestnet.farmdev.com/ --jstests-suite zamboni --jstests-browsers firefox --debug nose.plugins.jstests
|
||||
# These env vars are set in the Jenkins build step.
|
||||
python run_jstests.py -v --with-xunit --with-django-serv --django-host "$DJANGO_HOST" --django-port "$DJANGO_PORT" --django-log $LOG --with-jstests --jstests-server http://jstestnet.farmdev.com/ --jstests-suite zamboni --jstests-token "$JSTESTS_TOKEN" --jstests-url http://$DJANGO_HOST:$DJANGO_PORT/en-US/qunit --jstests-browsers firefox --debug nose.plugins.jstests
|
||||
|
||||
echo 'shazam!'
|
||||
|
|
Загрузка…
Ссылка в новой задаче