Skip to content

Commit e433b81

Browse files
authored
Merge pull request #3459 from takluyver/appveyor-path-fails
Undo patches in teardown before attempting to delete files
2 parents a7ac957 + acbeaf8 commit e433b81

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

notebook/tests/launchnotebook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,9 @@ def start_thread():
178178
def teardown_class(cls):
179179
cls.notebook.stop()
180180
cls.wait_until_dead()
181-
cls.tmp_dir.cleanup()
182181
cls.env_patch.stop()
183182
cls.path_patch.stop()
183+
cls.tmp_dir.cleanup()
184184
# cleanup global zmq Context, to ensure we aren't leaving dangling sockets
185185
def cleanup_zmq():
186186
zmq.Context.instance().term()

notebook/tree/tests/test_tree_handler.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
from notebook.utils import url_path_join
55
from nbformat import write
66
from nbformat.v4 import new_notebook
7+
try:
8+
from urllib.parse import urlparse
9+
except ImportError:
10+
from urlparse import urlparse
711

812
import requests
913

@@ -28,5 +32,7 @@ def test_redirect(self):
2832
r = self.request('GET', 'tree/foo/bar.ipynb')
2933
self.assertEqual(r.url, self.base_url() + 'notebooks/foo/bar.ipynb')
3034

31-
r = self.request('GET', 'tree/foo/baz.txt')
32-
self.assertEqual(r.url, url_path_join(self.base_url(), 'files/foo/baz.txt'))
35+
r = self.request('GET', 'tree/foo/baz.txt', allow_redirects=False)
36+
self.assertEqual(r.status_code, 302)
37+
self.assertEqual(r.headers['Location'],
38+
urlparse(url_path_join(self.base_url(), 'files/foo/baz.txt')).path)

0 commit comments

Comments
 (0)