Show More
@@ -161,6 +161,16 b' class APITest(NotebookTestBase):' | |||||
161 | with io.open(os_path, 'w', encoding='utf-8') as f: |
|
161 | with io.open(os_path, 'w', encoding='utf-8') as f: | |
162 | write(nb, f, version=4) |
|
162 | write(nb, f, version=4) | |
163 |
|
163 | |||
|
164 | def delete_dir(self, api_path): | |||
|
165 | """Delete a directory at api_path, removing any contents.""" | |||
|
166 | os_path = self.to_os_path(api_path) | |||
|
167 | shutil.rmtree(os_path, ignore_errors=True) | |||
|
168 | ||||
|
169 | def delete_file(self, api_path): | |||
|
170 | """Delete a file at the given path if it exists.""" | |||
|
171 | if self.isfile(api_path): | |||
|
172 | os.unlink(self.to_os_path(api_path)) | |||
|
173 | ||||
164 | def isfile(self, api_path): |
|
174 | def isfile(self, api_path): | |
165 | return os.path.isfile(self.to_os_path(api_path)) |
|
175 | return os.path.isfile(self.to_os_path(api_path)) | |
166 |
|
176 | |||
@@ -190,13 +200,9 b' class APITest(NotebookTestBase):' | |||||
190 | self.api = API(self.base_url()) |
|
200 | self.api = API(self.base_url()) | |
191 |
|
201 | |||
192 | def tearDown(self): |
|
202 | def tearDown(self): | |
193 | nbdir = self.notebook_dir.name |
|
|||
194 |
|
||||
195 | for dname in (list(self.top_level_dirs) + self.hidden_dirs): |
|
203 | for dname in (list(self.top_level_dirs) + self.hidden_dirs): | |
196 | shutil.rmtree(pjoin(nbdir, dname), ignore_errors=True) |
|
204 | self.delete_dir(dname) | |
197 |
|
205 | self.delete_file('inroot.ipynb') | ||
198 | if os.path.isfile(pjoin(nbdir, 'inroot.ipynb')): |
|
|||
199 | os.unlink(pjoin(nbdir, 'inroot.ipynb')) |
|
|||
200 |
|
206 | |||
201 | def test_list_notebooks(self): |
|
207 | def test_list_notebooks(self): | |
202 | nbs = notebooks_only(self.api.list().json()) |
|
208 | nbs = notebooks_only(self.api.list().json()) |
General Comments 0
You need to be logged in to leave comments.
Login now