##// END OF EJS Templates
Add Xunit support for JS tests...
Thomas Kluyver -
Show More
@@ -221,12 +221,12 b' class JSController(TestController):'
221 221 'jsonschema', 'jsonpointer']
222 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 225 """Create new test runner."""
226 226 TestController.__init__(self)
227 227 self.engine = engine
228 228 self.section = section
229 self.enabled = enabled
229 self.xunit = xunit
230 230 self.slimer_failure = re.compile('^FAIL.*', flags=re.MULTILINE)
231 231 js_test_dir = get_js_test_dir()
232 232 includes = '--includes=' + os.path.join(js_test_dir,'util.js')
@@ -240,7 +240,10 b' class JSController(TestController):'
240 240 self.dirs.append(self.nbdir)
241 241 os.makedirs(os.path.join(self.nbdir.name, os.path.join(u'sub ∂ir1', u'sub ∂ir 1a')))
242 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 247 # start the ipython notebook, so we get the port number
245 248 self.server_port = 0
246 249 self._init_server()
@@ -250,6 +253,10 b' class JSController(TestController):'
250 253 # don't launch tests if the server didn't start
251 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 260 def launch(self, buffer_output):
254 261 # If the engine is SlimerJS, we need to buffer the output because
255 262 # SlimerJS does not support exit codes, so CasperJS always returns 0.
@@ -281,7 +288,7 b' class JSController(TestController):'
281 288
282 289 @property
283 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 293 def _init_server(self):
287 294 "Start the notebook server in a separate process"
@@ -386,7 +393,7 b' def prepare_controllers(options):'
386 393 js_testgroups = all_js_groups()
387 394
388 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 397 c_py = [PyTestController(name, options) for name in py_testgroups]
391 398
392 399 controllers = c_py + c_js
General Comments 0
You need to be logged in to leave comments. Login now