##// 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 165 test_group_names = ['parallel', 'kernel', 'kernel.inprocess', 'config', 'core',
166 166 'extensions', 'lib', 'terminal', 'testing', 'utils',
167 'nbformat', 'qt', 'html', 'js', 'nbconvert'
167 'nbformat', 'qt', 'html', 'nbconvert'
168 168 ]
169 169
170 170 class TestSection(object):
@@ -288,9 +288,6 b" if not have['jinja2']:"
288 288 if not have['azure']:
289 289 sec.exclude('services.notebooks.azurenbmanager')
290 290
291 sec = test_sections['js']
292 sec.requires('zmq', 'tornado', 'jinja2', 'casperjs')
293
294 291 # config:
295 292 # Config files aren't really importable stand-alone
296 293 test_sections['config'].exclude('profile')
@@ -28,7 +28,7 b' import sys'
28 28 import subprocess
29 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 32 from IPython.utils.py3compat import bytes_to_str
33 33 from IPython.utils.sysinfo import sys_info
34 34 from IPython.utils.tempdir import TemporaryDirectory
@@ -57,14 +57,6 b' class TestController(object):'
57 57 self.env = {}
58 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 60 def launch(self):
69 61 # print('*** ENV:', self.env) # dbg
70 62 # print('*** CMD:', self.cmd) # dbg
@@ -132,6 +124,13 b' class PyTestController(TestController):'
132 124 # This means we won't get odd effects from our own matplotlib config
133 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 134 def add_xunit(self):
136 135 xunit_file = os.path.abspath(self.section + '.xunit.xml')
137 136 self.cmd.extend(['--with-xunit', '--xunit-file', xunit_file])
@@ -170,6 +169,7 b' class JSController(TestController):'
170 169 self.dirs.append(self.ipydir)
171 170 self.env['IPYTHONDIR'] = self.ipydir.name
172 171
172 def launch(self):
173 173 # start the ipython notebook, so we get the port number
174 174 self._init_server()
175 175
@@ -180,6 +180,11 b' class JSController(TestController):'
180 180 port = '--port=' + str(self.server_port)
181 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 189 def _init_server(self):
185 190 "Start the notebook server in a separate process"
@@ -193,6 +198,7 b' class JSController(TestController):'
193 198 self.server.join()
194 199 TestController.cleanup(self)
195 200
201 js_test_group_names = {'js'}
196 202
197 203 def run_webapp(q, nbdir, loglevel=0):
198 204 """start the IPython Notebook, and pass port back to the queue"""
@@ -212,13 +218,17 b' def prepare_controllers(options):'
212 218 not to run."""
213 219 testgroups = options.testgroups
214 220
215 if not testgroups:
216 testgroups = test_group_names
221 if testgroups:
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 227 if not options.all:
218 228 test_sections['parallel'].enabled = False
219 229
220 c_js = [JSController(name) for name in testgroups if 'js' in name]
221 c_py = [PyTestController(name) for name in testgroups if 'js' not in name]
230 c_js = [JSController(name) for name in js_testgroups]
231 c_py = [PyTestController(name) for name in py_testgroups]
222 232
223 233 configure_py_controllers(c_py, xunit=options.xunit,
224 234 coverage=options.coverage)
General Comments 0
You need to be logged in to leave comments. Login now