diff --git a/IPython/testing/iptestcontroller.py b/IPython/testing/iptestcontroller.py index f995592b8..f8518ead3 100644 --- a/IPython/testing/iptestcontroller.py +++ b/IPython/testing/iptestcontroller.py @@ -159,6 +159,14 @@ class PyTestController(TestController): self.cmd[2] = self.pycmd super(PyTestController, self).launch() +def get_js_test_dir(): + import IPython.html.tests as t + return os.path.join(os.path.dirname(t.__file__), 'casperjs') + +def all_js_groups(): + import glob + return glob.glob(get_js_test_dir() + '*/') + class JSController(TestController): """Run CasperJS tests """ def __init__(self, section): @@ -177,21 +185,11 @@ class JSController(TestController): def launch(self): # start the ipython notebook, so we get the port number self._init_server() - - import IPython.html.tests as t - test_dir = os.path.join(os.path.dirname(t.__file__), 'casperjs') - includes = '--includes=' + os.path.join(test_dir,'util.js') - - if self.section == 'js': - test_cases = os.path.join(test_dir, 'js') - elif self.section == 'notebook': - test_cases = os.path.join(test_dir, 'notebook') - elif self.section == 'widgets': - test_cases = os.path.join(test_dir, 'widgets') - + js_test_dir = get_js_test_dir() + includes = '--includes=' + os.path.join(js_test_dir,'util.js') + test_cases = os.path.join(js_test_dir, self.section) port = '--port=' + str(self.server_port) self.cmd = ['casperjs', 'test', port, includes, test_cases] - super(JSController, self).launch() @property @@ -210,8 +208,6 @@ class JSController(TestController): self.server.join() TestController.cleanup(self) -js_test_group_names = {'js', 'notebook', 'widgets'} - def run_webapp(q, ipydir, nbdir, loglevel=0): """start the IPython Notebook, and pass port back to the queue""" import os @@ -236,10 +232,13 @@ def prepare_controllers(options): if testgroups: py_testgroups = [g for g in testgroups if (g in py_test_group_names) \ or g.startswith('IPython.')] - js_testgroups = [g for g in testgroups if g in js_test_group_names] + if 'js' in testgroups: + js_testgroups = all_js_groups() + else: + js_testgroups = [g for g in testgroups if g not in py_testgroups] else: py_testgroups = py_test_group_names - js_testgroups = js_test_group_names + js_testgroups = all_js_group_names() if not options.all: test_sections['parallel'].enabled = False