Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tests, and fix discovered bugs #68

Merged
merged 24 commits into from Sep 13, 2017
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
33b0be2
Check that 'seek' method of 'openbin' objects returns the new position
Aug 31, 2017
1cb9bdb
Check that FS.copy and FS.copydir raise the right errors
Aug 31, 2017
509a780
Check that FS.move and FS.movedir raise the right errors
Aug 31, 2017
7a17ad3
Add tests for filesystems supporting unicode paths
Aug 31, 2017
1ce5c3e
Add tests to check case sensitivity
Aug 31, 2017
0e678ff
Fix `FTPFile` methods that didn't return a proper value
Sep 1, 2017
bcfbabf
Make `FS.move` raise `FileExpected` is the src_path is a folder
Sep 1, 2017
84700ac
Fix `FTPFile.truncate` not returning the new size
Sep 1, 2017
341085e
Fix `MemoryFile.truncate` and `MemoryFile.write` not returning anything
Sep 1, 2017
06a2411
Fix `MemoryFile.truncate` moving the cursor when given a size
Sep 1, 2017
8acd0d6
Fix `FS.copydir` not raising `DirectoryExpected` and `ResourceNotFound`
Sep 1, 2017
085c8a1
Check that FTP server supports UTF-8 before connecting to it for real
Sep 1, 2017
d6b4b3f
Check that syspath works fine with an UTF-8 filename
Sep 3, 2017
3ee3fc1
Rewrite TestFTPFS to use pyftpdlib.test.FTPd
Sep 3, 2017
1a36612
Fix ftpfs._encode not using utf-8 in Python 2.7
Sep 3, 2017
46003ff
Bump required pyftpdlib to 1.5.2
Sep 4, 2017
e738c3c
Make FTPFS properly encode/decode the FTP server response
Sep 4, 2017
72a0e6e
Fix nose mistaking ThreadedTestFTPd for a TestCase
Sep 4, 2017
8d3b88f
Make sure ftpfs._encode/_decode use the proper encoding
Sep 4, 2017
a9074bc
Remove potential bug in FTPFile.truncate
Sep 10, 2017
43e341b
Remove binary_type import from six
Sep 10, 2017
2f36daa
Add server encoding detection inside of `FTPFS.ftp`
Sep 10, 2017
5ed51f8
Use 'replace' error handling to decode server in `FTPFS`
Sep 10, 2017
357f334
Remove `FTPFile.__lenght_hint__`
Sep 10, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions fs/base.py
Expand Up @@ -318,6 +318,8 @@ def copydir(self, src_path, dst_path, create=False):
with self._lock:
if not create and not self.exists(dst_path):
raise errors.ResourceNotFound(dst_path)
if not self.getinfo(src_path).is_dir:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would isdir not be better? If you don't need the info object, then the FS object can use a potentially faster codepath.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling getinfo will raise a ResourceNotFound as expected, whereas if you were to use isdir you would need one call to check for the existence of a resource, and a second call to check that the resource is a directory.

Since the base implementation uses getinfo as a base for isdir, isfile and exist, it will result in only one call to getinfo to do as such but two calls otherwise.

raise errors.DirectoryExpected(src_path)
copy.copy_dir(
self,
src_path,
Expand Down Expand Up @@ -820,6 +822,8 @@ def move(self,

if not overwrite and self.exists(dst_path):
raise errors.DestinationExists(dst_path)
if self.getinfo(src_path).is_dir:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto here...

raise errors.FileExpected(src_path)
if self.getmeta().get('supports_rename', False):
try:
src_sys_path = self.getsyspath(src_path)
Expand Down