From 97de74b74d24177e841fad42cbe824c3c7a79134 2013-10-23 00:16:31 From: MinRK Date: 2013-10-23 00:16:31 Subject: [PATCH] Windows testing fixes --- diff --git a/IPython/html/services/notebooks/tests/test_notebooks_api.py b/IPython/html/services/notebooks/tests/test_notebooks_api.py index 9f3648d..c75903a 100644 --- a/IPython/html/services/notebooks/tests/test_notebooks_api.py +++ b/IPython/html/services/notebooks/tests/test_notebooks_api.py @@ -170,7 +170,11 @@ class APITest(NotebookTestBase): location_header = py3compat.str_to_unicode(resp.headers['Location']) self.assertEqual(location_header, url_escape(url_path_join(u'/api/notebooks', path, name))) self.assertEqual(resp.json()['name'], name) - assert os.path.isfile(pjoin(self.notebook_dir.name, path, name)) + assert os.path.isfile(pjoin( + self.notebook_dir.name, + path.replace('/', os.path.sep), + name, + )) def test_create_untitled(self): resp = self.nb_api.create_untitled(path=u'å b') @@ -182,7 +186,7 @@ class APITest(NotebookTestBase): # And two directories down resp = self.nb_api.create_untitled(path='foo/bar') - self._check_nb_created(resp, 'Untitled0.ipynb', pjoin('foo', 'bar')) + self._check_nb_created(resp, 'Untitled0.ipynb', 'foo/bar') def test_upload_untitled(self): nb = new_notebook(name='Upload test') diff --git a/IPython/html/tests/test_files.py b/IPython/html/tests/test_files.py index f2e85c2..fc6b239 100644 --- a/IPython/html/tests/test_files.py +++ b/IPython/html/tests/test_files.py @@ -30,18 +30,17 @@ class FilesTest(NotebookTestBase): path = pjoin(nbdir, d.replace('/', os.path.sep)) if not os.path.exists(path): os.mkdir(path) - with io.open(pjoin(path, 'foo'), 'w', encoding='utf8') as f: - f.write(path) - with io.open(pjoin(path, '.foo'), 'w', encoding='utf8') as f: - f.write(path + '.foo') + with open(pjoin(path, 'foo'), 'w') as f: + f.write('foo') + with open(pjoin(path, '.foo'), 'w') as f: + f.write('.foo') url = self.base_url() for d in not_hidden: path = pjoin(nbdir, d.replace('/', os.path.sep)) r = requests.get(url_path_join(url, 'files', d, 'foo')) r.raise_for_status() - reply = py3compat.cast_unicode(r.content) - self.assertEqual(normalize('NFC', path), normalize('NFC', reply)) + self.assertEqual(r.content, u'foo') r = requests.get(url_path_join(url, 'files', d, '.foo')) self.assertEqual(r.status_code, 403)