##// END OF EJS Templates
Merge pull request #5421 from takluyver/iptest-configure-after-setup...
Min RK -
r15968:e0692577 merge
parent child Browse files
Show More
@@ -127,13 +127,14 b' class PyTestController(TestController):'
127 127 #: str, Python command to execute in subprocess
128 128 pycmd = None
129 129
130 def __init__(self, section):
130 def __init__(self, section, options):
131 131 """Create new test runner."""
132 132 TestController.__init__(self)
133 133 self.section = section
134 134 # pycmd is put into cmd[2] in PyTestController.launch()
135 135 self.cmd = [sys.executable, '-c', None, section]
136 136 self.pycmd = "from IPython.testing.iptest import run_iptest; run_iptest()"
137 self.options = options
137 138
138 139 def setup(self):
139 140 ipydir = TemporaryDirectory()
@@ -145,6 +146,14 b' class PyTestController(TestController):'
145 146 # This means we won't get odd effects from our own matplotlib config
146 147 self.env['MPLCONFIGDIR'] = workingdir.name
147 148
149 # From options:
150 if self.options.xunit:
151 self.add_xunit()
152 if self.options.coverage:
153 self.add_coverage()
154 self.env['IPTEST_SUBPROC_STREAMS'] = self.options.subproc_streams
155 self.cmd.extend(self.options.extra_args)
156
148 157 @property
149 158 def will_run(self):
150 159 try:
@@ -273,28 +282,13 b' def prepare_controllers(options):'
273 282 test_sections['parallel'].enabled = False
274 283
275 284 c_js = [JSController(name) for name in js_testgroups]
276 c_py = [PyTestController(name) for name in py_testgroups]
277
278 configure_py_controllers(c_py, xunit=options.xunit,
279 coverage=options.coverage, subproc_streams=options.subproc_streams,
280 extra_args=options.extra_args)
285 c_py = [PyTestController(name, options) for name in py_testgroups]
281 286
282 287 controllers = c_py + c_js
283 288 to_run = [c for c in controllers if c.will_run]
284 289 not_run = [c for c in controllers if not c.will_run]
285 290 return to_run, not_run
286 291
287 def configure_py_controllers(controllers, xunit=False, coverage=False,
288 subproc_streams='capture', extra_args=()):
289 """Apply options for a collection of TestController objects."""
290 for controller in controllers:
291 if xunit:
292 controller.add_xunit()
293 if coverage:
294 controller.add_coverage()
295 controller.env['IPTEST_SUBPROC_STREAMS'] = subproc_streams
296 controller.cmd.extend(extra_args)
297
298 292 def do_run(controller, buffer_output=True):
299 293 """Setup and run a test controller.
300 294
General Comments 0
You need to be logged in to leave comments. Login now