##// END OF EJS Templates
Merge pull request #5972 from takluyver/js-tests-xunit...
Thomas Kluyver -
r16993:b6a05a57 merge
parent child Browse files
Show More
@@ -221,12 +221,12 class JSController(TestController):
221 'jsonschema', 'jsonpointer']
221 'jsonschema', 'jsonpointer']
222 display_slimer_output = False
222 display_slimer_output = False
223
223
224 def __init__(self, section, enabled=True, engine='phantomjs'):
224 def __init__(self, section, xunit=True, engine='phantomjs'):
225 """Create new test runner."""
225 """Create new test runner."""
226 TestController.__init__(self)
226 TestController.__init__(self)
227 self.engine = engine
227 self.engine = engine
228 self.section = section
228 self.section = section
229 self.enabled = enabled
229 self.xunit = xunit
230 self.slimer_failure = re.compile('^FAIL.*', flags=re.MULTILINE)
230 self.slimer_failure = re.compile('^FAIL.*', flags=re.MULTILINE)
231 js_test_dir = get_js_test_dir()
231 js_test_dir = get_js_test_dir()
232 includes = '--includes=' + os.path.join(js_test_dir,'util.js')
232 includes = '--includes=' + os.path.join(js_test_dir,'util.js')
@@ -240,7 +240,10 class JSController(TestController):
240 self.dirs.append(self.nbdir)
240 self.dirs.append(self.nbdir)
241 os.makedirs(os.path.join(self.nbdir.name, os.path.join(u'sub ∂ir1', u'sub ∂ir 1a')))
241 os.makedirs(os.path.join(self.nbdir.name, os.path.join(u'sub ∂ir1', u'sub ∂ir 1a')))
242 os.makedirs(os.path.join(self.nbdir.name, os.path.join(u'sub ∂ir2', u'sub ∂ir 1b')))
242 os.makedirs(os.path.join(self.nbdir.name, os.path.join(u'sub ∂ir2', u'sub ∂ir 1b')))
243
243
244 if self.xunit:
245 self.add_xunit()
246
244 # start the ipython notebook, so we get the port number
247 # start the ipython notebook, so we get the port number
245 self.server_port = 0
248 self.server_port = 0
246 self._init_server()
249 self._init_server()
@@ -250,6 +253,10 class JSController(TestController):
250 # don't launch tests if the server didn't start
253 # don't launch tests if the server didn't start
251 self.cmd = [sys.executable, '-c', 'raise SystemExit(1)']
254 self.cmd = [sys.executable, '-c', 'raise SystemExit(1)']
252
255
256 def add_xunit(self):
257 xunit_file = os.path.abspath(self.section.replace('/','.') + '.xunit.xml')
258 self.cmd.append('--xunit=%s' % xunit_file)
259
253 def launch(self, buffer_output):
260 def launch(self, buffer_output):
254 # If the engine is SlimerJS, we need to buffer the output because
261 # If the engine is SlimerJS, we need to buffer the output because
255 # SlimerJS does not support exit codes, so CasperJS always returns 0.
262 # SlimerJS does not support exit codes, so CasperJS always returns 0.
@@ -281,7 +288,7 class JSController(TestController):
281
288
282 @property
289 @property
283 def will_run(self):
290 def will_run(self):
284 return self.enabled and all(have[a] for a in self.requirements + [self.engine])
291 return all(have[a] for a in self.requirements + [self.engine])
285
292
286 def _init_server(self):
293 def _init_server(self):
287 "Start the notebook server in a separate process"
294 "Start the notebook server in a separate process"
@@ -386,7 +393,7 def prepare_controllers(options):
386 js_testgroups = all_js_groups()
393 js_testgroups = all_js_groups()
387
394
388 engine = 'slimerjs' if options.slimerjs else 'phantomjs'
395 engine = 'slimerjs' if options.slimerjs else 'phantomjs'
389 c_js = [JSController(name, engine=engine) for name in js_testgroups]
396 c_js = [JSController(name, xunit=options.xunit, engine=engine) for name in js_testgroups]
390 c_py = [PyTestController(name, options) for name in py_testgroups]
397 c_py = [PyTestController(name, options) for name in py_testgroups]
391
398
392 controllers = c_py + c_js
399 controllers = c_py + c_js
General Comments 0
You need to be logged in to leave comments. Login now