Show More
@@ -166,6 +166,10 b' class JSController(TestController):' | |||
|
166 | 166 | TestController.__init__(self) |
|
167 | 167 | self.section = section |
|
168 | 168 | |
|
169 | self.ipydir = TemporaryDirectory() | |
|
170 | self.dirs.append(self.ipydir) | |
|
171 | self.env['IPYTHONDIR'] = self.ipydir.name | |
|
172 | ||
|
169 | 173 | # start the ipython notebook, so we get the port number |
|
170 | 174 | self._init_server() |
|
171 | 175 | |
@@ -180,20 +184,21 b' class JSController(TestController):' | |||
|
180 | 184 | def _init_server(self): |
|
181 | 185 | "Start the notebook server in a separate process" |
|
182 | 186 | self.queue = q = Queue() |
|
183 |
self. |
|
|
184 | server.start() | |
|
187 | self.server = Process(target=run_webapp, args=(q, self.ipydir.name)) | |
|
188 | self.server.start() | |
|
185 | 189 | self.server_port = q.get() |
|
186 | 190 | |
|
187 | 191 | def cleanup(self): |
|
188 | 192 | self.server.terminate() |
|
193 | self.server.join() | |
|
189 | 194 | TestController.cleanup(self) |
|
190 | 195 | |
|
191 | 196 | |
|
192 | def run_webapp(q): | |
|
197 | def run_webapp(q, nbdir): | |
|
193 | 198 | """start the IPython Notebook, and pass port back to the queue""" |
|
194 | 199 | import IPython.html.notebookapp as nbapp |
|
195 | 200 | server = nbapp.NotebookApp() |
|
196 | server.initialize(['--no-browser']) | |
|
201 | server.initialize(['--no-browser', '--notebook-dir='+nbdir]) | |
|
197 | 202 | # communicate the port number to the parent process |
|
198 | 203 | q.put(server.port) |
|
199 | 204 | server.start() |
General Comments 0
You need to be logged in to leave comments.
Login now