Commit 30d4dc44 by Greg Price

Add paver option to specify js-test-tool port

This includes an upgrade to a newer version of js-test-tool that accepts
an option to specify the port number.
parent eacd5256
...@@ -18,12 +18,14 @@ __test__ = False # do not collect ...@@ -18,12 +18,14 @@ __test__ = False # do not collect
("suite=", "s", "Test suite to run"), ("suite=", "s", "Test suite to run"),
("mode=", "m", "dev or run"), ("mode=", "m", "dev or run"),
("coverage", "c", "Run test under coverage"), ("coverage", "c", "Run test under coverage"),
("port=", "p", "Port to run test server on (dev mode only)"),
]) ])
def test_js(options): def test_js(options):
""" """
Run the JavaScript tests Run the JavaScript tests
""" """
mode = getattr(options, 'mode', 'run') mode = getattr(options, 'mode', 'run')
port = None
if mode == 'run': if mode == 'run':
suite = getattr(options, 'suite', 'all') suite = getattr(options, 'suite', 'all')
...@@ -31,6 +33,7 @@ def test_js(options): ...@@ -31,6 +33,7 @@ def test_js(options):
elif mode == 'dev': elif mode == 'dev':
suite = getattr(options, 'suite', None) suite = getattr(options, 'suite', None)
coverage = False coverage = False
port = getattr(options, 'port')
else: else:
sys.stderr.write("Invalid mode. Please choose 'dev' or 'run'.") sys.stderr.write("Invalid mode. Please choose 'dev' or 'run'.")
return return
...@@ -43,7 +46,7 @@ def test_js(options): ...@@ -43,7 +46,7 @@ def test_js(options):
) )
return return
test_suite = JsTestSuite(suite, mode=mode, with_coverage=coverage) test_suite = JsTestSuite(suite, mode=mode, with_coverage=coverage, port=port)
test_suite.run() test_suite.run()
...@@ -63,6 +66,7 @@ def test_js_run(options): ...@@ -63,6 +66,7 @@ def test_js_run(options):
@task @task
@cmdopts([ @cmdopts([
("suite=", "s", "Test suite to run"), ("suite=", "s", "Test suite to run"),
("port=", "p", "Port to run test server on"),
]) ])
def test_js_dev(options): def test_js_dev(options):
""" """
......
...@@ -17,6 +17,7 @@ class JsTestSuite(TestSuite): ...@@ -17,6 +17,7 @@ class JsTestSuite(TestSuite):
super(JsTestSuite, self).__init__(*args, **kwargs) super(JsTestSuite, self).__init__(*args, **kwargs)
self.run_under_coverage = kwargs.get('with_coverage', True) self.run_under_coverage = kwargs.get('with_coverage', True)
self.mode = kwargs.get('mode', 'run') self.mode = kwargs.get('mode', 'run')
self.port = kwargs.get('port')
try: try:
self.test_id = (Env.JS_TEST_ID_FILES[Env.JS_TEST_ID_KEYS.index(self.root)]) self.test_id = (Env.JS_TEST_ID_FILES[Env.JS_TEST_ID_KEYS.index(self.root)])
...@@ -53,6 +54,9 @@ class JsTestSuite(TestSuite): ...@@ -53,6 +54,9 @@ class JsTestSuite(TestSuite):
) )
) )
if self.port:
cmd += " -p {port}".format(port=self.port)
if self.run_under_coverage: if self.run_under_coverage:
cmd += " --coverage-xml {report_dir}".format( cmd += " --coverage-xml {report_dir}".format(
report_dir=self.coverage_report report_dir=self.coverage_report
......
...@@ -24,7 +24,7 @@ git+https://github.com/pmitros/django-pyfs.git@d175715e0fe3367ec0f1ee429c242d603 ...@@ -24,7 +24,7 @@ git+https://github.com/pmitros/django-pyfs.git@d175715e0fe3367ec0f1ee429c242d603
git+https://github.com/edx/XBlock.git@2029af2a4b524310847decfb34ef39da8a30dc4e#egg=XBlock git+https://github.com/edx/XBlock.git@2029af2a4b524310847decfb34ef39da8a30dc4e#egg=XBlock
git+https://github.com/edx/codejail.git@66dd5a45e5072666ff9a70c768576e9ffd1daa4b#egg=codejail git+https://github.com/edx/codejail.git@66dd5a45e5072666ff9a70c768576e9ffd1daa4b#egg=codejail
git+https://github.com/edx/diff-cover.git@v0.7.2#egg=diff_cover git+https://github.com/edx/diff-cover.git@v0.7.2#egg=diff_cover
git+https://github.com/edx/js-test-tool.git@v0.1.5#egg=js_test_tool git+https://github.com/edx/js-test-tool.git@v0.1.6#egg=js_test_tool
git+https://github.com/edx/event-tracking.git@0.1.0#egg=event-tracking git+https://github.com/edx/event-tracking.git@0.1.0#egg=event-tracking
git+https://github.com/edx/bok-choy.git@4a259e3548a19e41cc39433caf68ea58d10a27ba#egg=bok_choy git+https://github.com/edx/bok-choy.git@4a259e3548a19e41cc39433caf68ea58d10a27ba#egg=bok_choy
git+https://github.com/edx-solutions/django-splash.git@7579d052afcf474ece1239153cffe1c89935bc4f#egg=django-splash git+https://github.com/edx-solutions/django-splash.git@7579d052afcf474ece1239153cffe1c89935bc4f#egg=django-splash
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment