##// END OF EJS Templates
allow testing individual js files...
Paul Ivanov -
Show More
@@ -159,6 +159,14 b' class PyTestController(TestController):'
159 self.cmd[2] = self.pycmd
159 self.cmd[2] = self.pycmd
160 super(PyTestController, self).launch()
160 super(PyTestController, self).launch()
161
161
162 def get_js_test_dir():
163 import IPython.html.tests as t
164 return os.path.join(os.path.dirname(t.__file__), 'casperjs')
165
166 def all_js_groups():
167 import glob
168 return glob.glob(get_js_test_dir() + '*/')
169
162 class JSController(TestController):
170 class JSController(TestController):
163 """Run CasperJS tests """
171 """Run CasperJS tests """
164 def __init__(self, section):
172 def __init__(self, section):
@@ -177,21 +185,11 b' class JSController(TestController):'
177 def launch(self):
185 def launch(self):
178 # start the ipython notebook, so we get the port number
186 # start the ipython notebook, so we get the port number
179 self._init_server()
187 self._init_server()
180
188 js_test_dir = get_js_test_dir()
181 import IPython.html.tests as t
189 includes = '--includes=' + os.path.join(js_test_dir,'util.js')
182 test_dir = os.path.join(os.path.dirname(t.__file__), 'casperjs')
190 test_cases = os.path.join(js_test_dir, self.section)
183 includes = '--includes=' + os.path.join(test_dir,'util.js')
184
185 if self.section == 'js':
186 test_cases = os.path.join(test_dir, 'js')
187 elif self.section == 'notebook':
188 test_cases = os.path.join(test_dir, 'notebook')
189 elif self.section == 'widgets':
190 test_cases = os.path.join(test_dir, 'widgets')
191
192 port = '--port=' + str(self.server_port)
191 port = '--port=' + str(self.server_port)
193 self.cmd = ['casperjs', 'test', port, includes, test_cases]
192 self.cmd = ['casperjs', 'test', port, includes, test_cases]
194
195 super(JSController, self).launch()
193 super(JSController, self).launch()
196
194
197 @property
195 @property
@@ -210,8 +208,6 b' class JSController(TestController):'
210 self.server.join()
208 self.server.join()
211 TestController.cleanup(self)
209 TestController.cleanup(self)
212
210
213 js_test_group_names = {'js', 'notebook', 'widgets'}
214
215 def run_webapp(q, ipydir, nbdir, loglevel=0):
211 def run_webapp(q, ipydir, nbdir, loglevel=0):
216 """start the IPython Notebook, and pass port back to the queue"""
212 """start the IPython Notebook, and pass port back to the queue"""
217 import os
213 import os
@@ -236,10 +232,13 b' def prepare_controllers(options):'
236 if testgroups:
232 if testgroups:
237 py_testgroups = [g for g in testgroups if (g in py_test_group_names) \
233 py_testgroups = [g for g in testgroups if (g in py_test_group_names) \
238 or g.startswith('IPython.')]
234 or g.startswith('IPython.')]
239 js_testgroups = [g for g in testgroups if g in js_test_group_names]
235 if 'js' in testgroups:
236 js_testgroups = all_js_groups()
237 else:
238 js_testgroups = [g for g in testgroups if g not in py_testgroups]
240 else:
239 else:
241 py_testgroups = py_test_group_names
240 py_testgroups = py_test_group_names
242 js_testgroups = js_test_group_names
241 js_testgroups = all_js_group_names()
243 if not options.all:
242 if not options.all:
244 test_sections['parallel'].enabled = False
243 test_sections['parallel'].enabled = False
245
244
General Comments 0
You need to be logged in to leave comments. Login now