##// END OF EJS Templates
Add --url option to iptest
Jonathan Frederic -
Show More
@@ -3,9 +3,9 b''
3 3 //
4 4 casper.get_notebook_server = function () {
5 5 // Get the URL of a notebook server on which to run tests.
6 port = casper.cli.get("port");
6 var port = casper.cli.get("port");
7 7 port = (typeof port === 'undefined') ? '8888' : port;
8 return 'http://127.0.0.1:' + port;
8 return casper.cli.get("url") || 'http://127.0.0.1:' + port;
9 9 };
10 10
11 11 casper.open_new_notebook = function () {
@@ -220,16 +220,18 b' def all_js_groups():'
220 220
221 221 class JSController(TestController):
222 222 """Run CasperJS tests """
223
223 224 requirements = ['zmq', 'tornado', 'jinja2', 'casperjs', 'sqlite3',
224 225 'jsonschema']
225 226 display_slimer_output = False
226 227
227 def __init__(self, section, xunit=True, engine='phantomjs'):
228 def __init__(self, section, xunit=True, engine='phantomjs', url=None):
228 229 """Create new test runner."""
229 230 TestController.__init__(self)
230 231 self.engine = engine
231 232 self.section = section
232 233 self.xunit = xunit
234 self.url = url
233 235 self.slimer_failure = re.compile('^FAIL.*', flags=re.MULTILINE)
234 236 js_test_dir = get_js_test_dir()
235 237 includes = '--includes=' + os.path.join(js_test_dir,'util.js')
@@ -247,14 +249,18 b' class JSController(TestController):'
247 249 if self.xunit:
248 250 self.add_xunit()
249 251
250 # start the ipython notebook, so we get the port number
251 self.server_port = 0
252 self._init_server()
253 if self.server_port:
254 self.cmd.append("--port=%i" % self.server_port)
252 # If a url was specified, use that for the testing.
253 if self.url:
254 self.cmd.append("--url=%s" % self.url)
255 255 else:
256 # don't launch tests if the server didn't start
257 self.cmd = [sys.executable, '-c', 'raise SystemExit(1)']
256 # start the ipython notebook, so we get the port number
257 self.server_port = 0
258 self._init_server()
259 if self.server_port:
260 self.cmd.append("--port=%i" % self.server_port)
261 else:
262 # don't launch tests if the server didn't start
263 self.cmd = [sys.executable, '-c', 'raise SystemExit(1)']
258 264
259 265 def add_xunit(self):
260 266 xunit_file = os.path.abspath(self.section.replace('/','.') + '.xunit.xml')
@@ -401,7 +407,7 b' def prepare_controllers(options):'
401 407 js_testgroups = all_js_groups()
402 408
403 409 engine = 'slimerjs' if options.slimerjs else 'phantomjs'
404 c_js = [JSController(name, xunit=options.xunit, engine=engine) for name in js_testgroups]
410 c_js = [JSController(name, xunit=options.xunit, engine=engine, url=options.url) for name in js_testgroups]
405 411 c_py = [PyTestController(name, options) for name in py_testgroups]
406 412
407 413 controllers = c_py + c_js
@@ -509,6 +515,9 b' def run_iptestall(options):'
509 515 slimerjs : bool
510 516 Use slimerjs if it's installed instead of phantomjs for casperjs tests.
511 517
518 url : unicode
519 Address:port to use when running the JS tests.
520
512 521 xunit : bool
513 522 Produce Xunit XML output. This is written to multiple foo.xunit.xml files.
514 523
@@ -637,6 +646,8 b" argparser.add_argument('--all', action='store_true',"
637 646 help='Include slow tests not run by default.')
638 647 argparser.add_argument('--slimerjs', action='store_true',
639 648 help="Use slimerjs if it's installed instead of phantomjs for casperjs tests.")
649 argparser.add_argument('--url', const=None, default='', type=unicode,
650 help="URL to use for the JS tests.")
640 651 argparser.add_argument('-j', '--fast', nargs='?', const=None, default=1, type=int,
641 652 help='Run test sections in parallel. This starts as many '
642 653 'processes as you have cores, or you can specify a number.')
General Comments 0
You need to be logged in to leave comments. Login now