##// END OF EJS Templates
Separate out machinery for running JS tests
Thomas Kluyver -
Show More
@@ -164,7 +164,7 b" have['zmq'] = test_for('zmq.pyzmq_version_info', min_zmq, callback=lambda x: x()"
164
164
165 test_group_names = ['parallel', 'kernel', 'kernel.inprocess', 'config', 'core',
165 test_group_names = ['parallel', 'kernel', 'kernel.inprocess', 'config', 'core',
166 'extensions', 'lib', 'terminal', 'testing', 'utils',
166 'extensions', 'lib', 'terminal', 'testing', 'utils',
167 'nbformat', 'qt', 'html', 'js', 'nbconvert'
167 'nbformat', 'qt', 'html', 'nbconvert'
168 ]
168 ]
169
169
170 class TestSection(object):
170 class TestSection(object):
@@ -288,9 +288,6 b" if not have['jinja2']:"
288 if not have['azure']:
288 if not have['azure']:
289 sec.exclude('services.notebooks.azurenbmanager')
289 sec.exclude('services.notebooks.azurenbmanager')
290
290
291 sec = test_sections['js']
292 sec.requires('zmq', 'tornado', 'jinja2', 'casperjs')
293
294 # config:
291 # config:
295 # Config files aren't really importable stand-alone
292 # Config files aren't really importable stand-alone
296 test_sections['config'].exclude('profile')
293 test_sections['config'].exclude('profile')
@@ -28,7 +28,7 b' import sys'
28 import subprocess
28 import subprocess
29 import time
29 import time
30
30
31 from .iptest import have, test_group_names, test_sections
31 from .iptest import have, test_group_names as py_test_group_names, test_sections
32 from IPython.utils.py3compat import bytes_to_str
32 from IPython.utils.py3compat import bytes_to_str
33 from IPython.utils.sysinfo import sys_info
33 from IPython.utils.sysinfo import sys_info
34 from IPython.utils.tempdir import TemporaryDirectory
34 from IPython.utils.tempdir import TemporaryDirectory
@@ -57,14 +57,6 b' class TestController(object):'
57 self.env = {}
57 self.env = {}
58 self.dirs = []
58 self.dirs = []
59
59
60
61 @property
62 def will_run(self):
63 try:
64 return test_sections[self.section].will_run
65 except KeyError:
66 return True
67
68 def launch(self):
60 def launch(self):
69 # print('*** ENV:', self.env) # dbg
61 # print('*** ENV:', self.env) # dbg
70 # print('*** CMD:', self.cmd) # dbg
62 # print('*** CMD:', self.cmd) # dbg
@@ -132,6 +124,13 b' class PyTestController(TestController):'
132 # This means we won't get odd effects from our own matplotlib config
124 # This means we won't get odd effects from our own matplotlib config
133 self.env['MPLCONFIGDIR'] = workingdir.name
125 self.env['MPLCONFIGDIR'] = workingdir.name
134
126
127 @property
128 def will_run(self):
129 try:
130 return test_sections[self.section].will_run
131 except KeyError:
132 return True
133
135 def add_xunit(self):
134 def add_xunit(self):
136 xunit_file = os.path.abspath(self.section + '.xunit.xml')
135 xunit_file = os.path.abspath(self.section + '.xunit.xml')
137 self.cmd.extend(['--with-xunit', '--xunit-file', xunit_file])
136 self.cmd.extend(['--with-xunit', '--xunit-file', xunit_file])
@@ -170,6 +169,7 b' class JSController(TestController):'
170 self.dirs.append(self.ipydir)
169 self.dirs.append(self.ipydir)
171 self.env['IPYTHONDIR'] = self.ipydir.name
170 self.env['IPYTHONDIR'] = self.ipydir.name
172
171
172 def launch(self):
173 # start the ipython notebook, so we get the port number
173 # start the ipython notebook, so we get the port number
174 self._init_server()
174 self._init_server()
175
175
@@ -180,6 +180,11 b' class JSController(TestController):'
180 port = '--port=' + str(self.server_port)
180 port = '--port=' + str(self.server_port)
181 self.cmd = ['casperjs', 'test', port, includes, test_cases]
181 self.cmd = ['casperjs', 'test', port, includes, test_cases]
182
182
183 super(JSController, self).launch()
184
185 @property
186 def will_run(self):
187 return all(have[a] for a in ['zmq', 'tornado', 'jinja2', 'casperjs'])
183
188
184 def _init_server(self):
189 def _init_server(self):
185 "Start the notebook server in a separate process"
190 "Start the notebook server in a separate process"
@@ -193,6 +198,7 b' class JSController(TestController):'
193 self.server.join()
198 self.server.join()
194 TestController.cleanup(self)
199 TestController.cleanup(self)
195
200
201 js_test_group_names = {'js'}
196
202
197 def run_webapp(q, nbdir, loglevel=0):
203 def run_webapp(q, nbdir, loglevel=0):
198 """start the IPython Notebook, and pass port back to the queue"""
204 """start the IPython Notebook, and pass port back to the queue"""
@@ -212,13 +218,17 b' def prepare_controllers(options):'
212 not to run."""
218 not to run."""
213 testgroups = options.testgroups
219 testgroups = options.testgroups
214
220
215 if not testgroups:
221 if testgroups:
216 testgroups = test_group_names
222 py_testgroups = [g for g in testgroups if g in py_test_group_names]
223 js_testgroups = [g for g in testgroups if g in js_test_group_names]
224 else:
225 py_testgroups = py_test_group_names
226 js_testgroups = js_test_group_names
217 if not options.all:
227 if not options.all:
218 test_sections['parallel'].enabled = False
228 test_sections['parallel'].enabled = False
219
229
220 c_js = [JSController(name) for name in testgroups if 'js' in name]
230 c_js = [JSController(name) for name in js_testgroups]
221 c_py = [PyTestController(name) for name in testgroups if 'js' not in name]
231 c_py = [PyTestController(name) for name in py_testgroups]
222
232
223 configure_py_controllers(c_py, xunit=options.xunit,
233 configure_py_controllers(c_py, xunit=options.xunit,
224 coverage=options.coverage)
234 coverage=options.coverage)
General Comments 0
You need to be logged in to leave comments. Login now