Show More
@@ -211,7 +211,7 b' def install_nbextension(path, overwrite=False, symlink=False, user=False, prefix' | |||||
211 | destination = basename(path) |
|
211 | destination = basename(path) | |
212 | destination = cast_unicode_py2(destination) |
|
212 | destination = cast_unicode_py2(destination) | |
213 | full_dest = pjoin(nbext, destination) |
|
213 | full_dest = pjoin(nbext, destination) | |
214 | if overwrite and os.path.exists(full_dest): |
|
214 | if overwrite and os.path.lexists(full_dest): | |
215 | if verbose >= 1: |
|
215 | if verbose >= 1: | |
216 | print("removing %s" % full_dest) |
|
216 | print("removing %s" % full_dest) | |
217 | if os.path.isdir(full_dest) and not os.path.islink(full_dest): |
|
217 | if os.path.isdir(full_dest) and not os.path.islink(full_dest): |
@@ -280,6 +280,22 b' class TestInstallNBExtension(TestCase):' | |||||
280 | self.assertEqual(link, src) |
|
280 | self.assertEqual(link, src) | |
281 |
|
281 | |||
282 | @dec.skip_win32 |
|
282 | @dec.skip_win32 | |
|
283 | def test_overwrite_broken_symlink(self): | |||
|
284 | with TemporaryDirectory() as d: | |||
|
285 | f = u'ƒ.js' | |||
|
286 | f2 = u'ƒ2.js' | |||
|
287 | src = pjoin(d, f) | |||
|
288 | src2 = pjoin(d, f2) | |||
|
289 | touch(src) | |||
|
290 | install_nbextension(src, symlink=True) | |||
|
291 | os.rename(src, src2) | |||
|
292 | install_nbextension(src2, symlink=True, overwrite=True, destination=f) | |||
|
293 | dest = pjoin(self.system_nbext, f) | |||
|
294 | assert os.path.islink(dest) | |||
|
295 | link = os.readlink(dest) | |||
|
296 | self.assertEqual(link, src2) | |||
|
297 | ||||
|
298 | @dec.skip_win32 | |||
283 | def test_install_symlink_destination(self): |
|
299 | def test_install_symlink_destination(self): | |
284 | with TemporaryDirectory() as d: |
|
300 | with TemporaryDirectory() as d: | |
285 | f = u'ƒ.js' |
|
301 | f = u'ƒ.js' |
General Comments 0
You need to be logged in to leave comments.
Login now