##// END OF EJS Templates
Better integrate output from slimerjs tests
Thomas Kluyver -
Show More
@@ -218,6 +218,8 b' def all_js_groups():'
218 class JSController(TestController):
218 class JSController(TestController):
219 """Run CasperJS tests """
219 """Run CasperJS tests """
220 requirements = ['zmq', 'tornado', 'jinja2', 'casperjs', 'sqlite3']
220 requirements = ['zmq', 'tornado', 'jinja2', 'casperjs', 'sqlite3']
221 display_slimer_output = False
222
221 def __init__(self, section, enabled=True, engine='phantomjs'):
223 def __init__(self, section, enabled=True, engine='phantomjs'):
222 """Create new test runner."""
224 """Create new test runner."""
223 TestController.__init__(self)
225 TestController.__init__(self)
@@ -249,10 +251,13 b' class JSController(TestController):'
249
251
250 def launch(self, buffer_output):
252 def launch(self, buffer_output):
251 # If the engine is SlimerJS, we need to buffer the output because
253 # If the engine is SlimerJS, we need to buffer the output because
252 # SlimerJS does not support exit codes, therefor CasperJS always returns
254 # SlimerJS does not support exit codes, so CasperJS always returns 0.
253 # 0 which is a false positive.
255 if self.engine == 'slimerjs' and not buffer_output:
254 buffer_output = (self.engine == 'slimerjs') or buffer_output
256 self.display_slimer_output = True
255 super(JSController, self).launch(buffer_output=buffer_output)
257 return super(JSController, self).launch(buffer_output=True)
258
259 else:
260 return super(JSController, self).launch(buffer_output=buffer_output)
256
261
257 def wait(self, *pargs, **kwargs):
262 def wait(self, *pargs, **kwargs):
258 """Wait for the JSController to finish"""
263 """Wait for the JSController to finish"""
@@ -261,8 +266,12 b' class JSController(TestController):'
261 # errors. Otherwise, just return the return code.
266 # errors. Otherwise, just return the return code.
262 if self.engine == 'slimerjs':
267 if self.engine == 'slimerjs':
263 stdout = bytes_to_str(self.stdout)
268 stdout = bytes_to_str(self.stdout)
264 print(stdout)
269 if self.display_slimer_output:
265 return self.slimer_failure.search(strip_ansi(stdout))
270 print(stdout)
271 if ret != 0:
272 # This could still happen e.g. if it's stopped by SIGINT
273 return ret
274 return bool(self.slimer_failure.search(strip_ansi(stdout)))
266 else:
275 else:
267 return ret
276 return ret
268
277
General Comments 0
You need to be logged in to leave comments. Login now