##// END OF EJS Templates
Cleaning up JS tests controller.
Brian E. Granger -
Show More
@@ -167,13 +167,12 b' class JSController(TestController):'
167 self.section = section
167 self.section = section
168
168
169 self.ipydir = TemporaryDirectory()
169 self.ipydir = TemporaryDirectory()
170 self.nbdir = os.path.join(self.ipydir.name, 'notebooks')
170 self.nbdir = TemporaryDirectory()
171 print("Running notebook tests in directory: %r" % self.nbdir)
171 print("Running notebook tests in directory: %r" % self.nbdir.name)
172 os.makedirs(os.path.join(self.nbdir, 'subdir1/subdir1a'))
172 os.makedirs(os.path.join(self.nbdir.name, os.path.join('subdir1', 'subdir1a')))
173 os.makedirs(os.path.join(self.nbdir, 'subdir2/subdir2a'))
173 os.makedirs(os.path.join(self.nbdir.name, os.path.join('subdir2', 'subdir2a')))
174 # print(self.ipydir.name)
175 self.dirs.append(self.ipydir)
174 self.dirs.append(self.ipydir)
176 self.env['IPYTHONDIR'] = self.ipydir.name
175 self.dirs.append(self.nbdir)
177
176
178 def launch(self):
177 def launch(self):
179 # start the ipython notebook, so we get the port number
178 # start the ipython notebook, so we get the port number
@@ -195,7 +194,7 b' class JSController(TestController):'
195 def _init_server(self):
194 def _init_server(self):
196 "Start the notebook server in a separate process"
195 "Start the notebook server in a separate process"
197 self.queue = q = Queue()
196 self.queue = q = Queue()
198 self.server = Process(target=run_webapp, args=(q, self.ipydir.name, self.nbdir))
197 self.server = Process(target=run_webapp, args=(q, self.ipydir.name, self.nbdir.name))
199 self.server.start()
198 self.server.start()
200 self.server_port = q.get()
199 self.server_port = q.get()
201
200
@@ -212,12 +211,11 b' def run_webapp(q, ipydir, nbdir, loglevel=0):'
212 import IPython.html.notebookapp as nbapp
211 import IPython.html.notebookapp as nbapp
213 import sys
212 import sys
214 sys.stderr = open(os.devnull, 'w')
213 sys.stderr = open(os.devnull, 'w')
215 os.environ["IPYTHONDIR"] = ipydir
216 server = nbapp.NotebookApp()
214 server = nbapp.NotebookApp()
217 args = ['--no-browser']
215 args = ['--no-browser']
218 args.append('--notebook-dir='+nbdir)
216 args.extend(['--ipython-dir', ipydir])
219 args.append('--profile-dir='+ipydir)
217 args.extend(['--notebook-dir', nbdir])
220 args.append('--log-level='+str(loglevel))
218 args.extend(['--log-level', str(loglevel)])
221 server.initialize(args)
219 server.initialize(args)
222 # communicate the port number to the parent process
220 # communicate the port number to the parent process
223 q.put(server.port)
221 q.put(server.port)
General Comments 0
You need to be logged in to leave comments. Login now