Skip to content

Commit 3e02968

Browse files
authored
Merge pull request #424 from sbraz/test_copy_sendfile
Do not test the patched copy implementation with Python 3.8+, fixes #421
2 parents 63a14f7 + 5df7f7d commit 3e02968

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1212
- Start testing on PyPy. Due to [#342](https://github.com/PyFilesystem/pyfilesystem2/issues/342)
1313
we have to treat PyPy builds specially and allow them to fail, but at least we'll
1414
be able to see if we break something aside from known issues with FTP tests.
15+
- Stop patching copy with Python 3.8+ because it already uses sendfile.
1516

1617
## [2.4.11] - 2019-09-07
1718

CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Many thanks to the following developers for contributing to this project:
66
- [Diego Argueta](https://github.com/dargueta)
77
- [Geoff Jukes](https://github.com/geoffjukes)
88
- [Giampaolo](https://github.com/gpcimino)
9+
- [Louis Sautier](https://github.com/sbraz)
910
- [Martin Larralde](https://github.com/althonos)
1011
- [Will McGugan](https://github.com/willmcgugan)
1112
- [Zmej Serow](https://github.com/zmej-serow)

fs/osfs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ def _check_copy(self, src_path, dst_path, overwrite=False):
419419
raise errors.DirectoryExpected(dirname(dst_path))
420420
return _src_path, _dst_path
421421

422-
if sys.version_info[:2] <= (3, 8) and sendfile is not None:
422+
if sys.version_info[:2] < (3, 8) and sendfile is not None:
423423

424424
_sendfile_error_codes = {
425425
errno.EIO,

tests/test_osfs.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import os
77
import shutil
88
import tempfile
9+
import sys
910
import unittest
1011
import pytest
1112

@@ -88,6 +89,11 @@ def test_expand_vars(self):
8889
self.assertNotIn("TYRIONLANISTER", fs2.getsyspath("/"))
8990

9091
@pytest.mark.skipif(osfs.sendfile is None, reason="sendfile not supported")
92+
@pytest.mark.skipif(
93+
sys.version_info >= (3, 8),
94+
reason="the copy function uses sendfile in Python 3.8+, "
95+
"making the patched implementation irrelevant",
96+
)
9197
def test_copy_sendfile(self):
9298
# try copying using sendfile
9399
with mock.patch.object(osfs, "sendfile") as sendfile:

0 commit comments

Comments
 (0)