Skip to content

Commit

Permalink
Merge 356e71c into 84719be
Browse files Browse the repository at this point in the history
  • Loading branch information
dargueta committed Aug 6, 2019
2 parents 84719be + 356e71c commit 7737904
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Fixed tests leaving tmp files
- Fixed typing issues
- Fixed link namespace returning bytes
- Fixed missing `errno.ENOTSUP` on PyPy. Closes [#338](https://github.com/PyFilesystem/pyfilesystem2/issues/338).

## [2.4.10] - 2019-07-29

Expand Down
7 changes: 6 additions & 1 deletion fs/osfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@
_WINDOWS_PLATFORM = platform.system() == "Windows"


# PyPy doesn't define this so we may need to provide this error code ourselves. The
# fallback value here is the CPython errno.ENOTSUP on OSX.
ENOTSUP = getattr(errno, "ENOTSUP", 45) # type: int


@six.python_2_unicode_compatible
class OSFS(FS):
"""Create an OSFS.
Expand Down Expand Up @@ -425,7 +430,7 @@ def _check_copy(self, src_path, dst_path, overwrite=False):
errno.EIO,
errno.EINVAL,
errno.ENOSYS,
errno.ENOTSUP, # type: ignore
ENOTSUP,
errno.EBADF,
errno.ENOTSOCK,
errno.EOPNOTSUPP,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_osfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def test_expand_vars(self):
def test_copy_sendfile(self):
# try copying using sendfile
with mock.patch.object(osfs, "sendfile") as sendfile:
sendfile.side_effect = OSError(errno.ENOTSUP, "sendfile not supported")
sendfile.side_effect = OSError(osfs.ENOTSUP, "sendfile not supported")
self.test_copy()
# check other errors are transmitted
self.fs.touch("foo")
Expand Down

0 comments on commit 7737904

Please sign in to comment.