##// END OF EJS Templates
JSController working, `iptest js` runs casperjs
Paul Ivanov -
Show More
@@ -56,10 +56,13 b' class TestController(object):'
56 56 self.env = {}
57 57 self.dirs = []
58 58
59
59 60 @property
60 61 def will_run(self):
61 """Override in subclasses to check for dependencies."""
62 return False
62 try:
63 return test_sections[self.section].will_run
64 except KeyError:
65 return True
63 66
64 67 def launch(self):
65 68 # print('*** ENV:', self.env) # dbg
@@ -128,13 +131,6 b' class PyTestController(TestController):'
128 131 # This means we won't get odd effects from our own matplotlib config
129 132 self.env['MPLCONFIGDIR'] = workingdir.name
130 133
131 @property
132 def will_run(self):
133 try:
134 return test_sections[self.section].will_run
135 except KeyError:
136 return True
137
138 134 def add_xunit(self):
139 135 xunit_file = os.path.abspath(self.section + '.xunit.xml')
140 136 self.cmd.extend(['--with-xunit', '--xunit-file', xunit_file])
@@ -162,21 +158,42 b' class PyTestController(TestController):'
162 158 self.cmd[2] = self.pycmd
163 159 super(PyTestController, self).launch()
164 160
165 def prepare_controllers(testgroups=None, inc_slow=False):
161 class JSController(TestController):
162 """Run CasperJS tests """
163 def __init__(self, section):
164 """Create new test runner."""
165 TestController.__init__(self)
166 self.section = section
167
168 import IPython.html.tests as t
169 test_dir = os.path.join(os.path.dirname(t.__file__), 'casperjs')
170 includes = '--includes=' + os.path.join(test_dir,'util.js')
171 test_cases = os.path.join(test_dir, 'test_cases')
172 self.cmd = ['casperjs', 'test', includes, test_cases]
173
174
175 def prepare_controllers(options):
166 176 """Returns two lists of TestController instances, those to run, and those
167 177 not to run."""
178 testgroups = options.testgroups
179
168 180 if not testgroups:
169 181 testgroups = test_group_names
170 if not inc_slow:
182 if not options.all:
171 183 test_sections['parallel'].enabled = False
172 184
173 controllers = [PyTestController(name) for name in testgroups]
185 c_js = [JSController(name) for name in testgroups if 'js' in name]
186 c_py = [PyTestController(name) for name in testgroups if 'js' not in name]
174 187
188 configure_py_controllers(c_py, xunit=options.xunit,
189 coverage=options.coverage)
190
191 controllers = c_py + c_js
175 192 to_run = [c for c in controllers if c.will_run]
176 193 not_run = [c for c in controllers if not c.will_run]
177 194 return to_run, not_run
178 195
179 def configure_controllers(controllers, xunit=False, coverage=False, extra_args=()):
196 def configure_py_controllers(controllers, xunit=False, coverage=False, extra_args=()):
180 197 """Apply options for a collection of TestController objects."""
181 198 for controller in controllers:
182 199 if xunit:
@@ -267,10 +284,7 b' def run_iptestall(options):'
267 284 # If running in parallel, capture output so it doesn't get interleaved
268 285 TestController.buffer_output = True
269 286
270 to_run, not_run = prepare_controllers(options.testgroups, inc_slow=options.all)
271
272 configure_controllers(to_run, xunit=options.xunit, coverage=options.coverage,
273 extra_args=options.extra_args)
287 to_run, not_run = prepare_controllers(options)
274 288
275 289 def justify(ltext, rtext, width=70, fill='-'):
276 290 ltext += ' '
General Comments 0
You need to be logged in to leave comments. Login now