##// END OF EJS Templates
Backport PR #6583: Windows symlink test fixes...
MinRK -
Show More
@@ -260,7 +260,12 b" def atomic_writing(path, text=True, encoding='utf-8', **kwargs):"
260 **kwargs
260 **kwargs
261 Passed to :func:`io.open`.
261 Passed to :func:`io.open`.
262 """
262 """
263 path = os.path.realpath(path) # Dereference symlinks
263 # realpath doesn't work on Windows: http://bugs.python.org/issue9949
264 # Luckily, we only need to resolve the file itself being a symlink, not
265 # any of its directories, so this will suffice:
266 if os.path.islink(path):
267 path = os.path.join(os.path.dirname(path), os.readlink(path))
268
264 dirname, basename = os.path.split(path)
269 dirname, basename = os.path.split(path)
265 handle, tmp_path = tempfile.mkstemp(prefix=basename, dir=dirname, text=text)
270 handle, tmp_path = tempfile.mkstemp(prefix=basename, dir=dirname, text=text)
266 if text:
271 if text:
@@ -144,7 +144,10 b' def test_atomic_writing():'
144 try:
144 try:
145 os.symlink(f1, f2)
145 os.symlink(f1, f2)
146 have_symlink = True
146 have_symlink = True
147 except (AttributeError, NotImplementedError):
147 except (AttributeError, NotImplementedError, OSError):
148 # AttributeError: Python doesn't support it
149 # NotImplementedError: The system doesn't support it
150 # OSError: The user lacks the privilege (Windows)
148 have_symlink = False
151 have_symlink = False
149
152
150 with nt.assert_raises(CustomExc):
153 with nt.assert_raises(CustomExc):
General Comments 0
You need to be logged in to leave comments. Login now