Commits

Jason R. Coombs  committed 4ce5af0

Fixed Exception in islink; added regression test.

  • Participants
  • Parent commits ecc2393
  • Tags 2.6

Comments (0)

Files changed (3)

 Changes
 -------
 
-2.5.1
-~~~~~
+2.6
+~~~
 
 * Fixed import issue in jaraco.windows.filesystem on Python 3.
+* Added cookie module from jaraco.net.
+* Fixed issue in filesystem.islink() where a call against a nonexistent
+  file could raise an Exception.
 
 2.5
 ~~~

File jaraco/windows/filesystem/__init__.py

 def is_reparse_point(path):
 	"""
 	Determine if the given path is a reparse point.
+	Return False if the file does not exist or the file attributes cannot
+	be determined.
 	"""
 	res = api.GetFileAttributes(path)
-	if res == api.INVALID_FILE_ATTRIBUTES: raise WindowsError()
-	return bool(res & api.FILE_ATTRIBUTE_REPARSE_POINT)
+	return (
+		res != api.INVALID_FILE_ATTRIBUTES
+		and bool(res & api.FILE_ATTRIBUTE_REPARSE_POINT)
+	)
 
 def islink(path):
 	"Determine if the given path is a symlink"

File tests/test_filesystem.py

+import py.test
+
+from jaraco.windows import filesystem
+
+def test_islink_on_nonexistent_target():
+	assert filesystem.islink('/doesnotexist') == False