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

Fixed bug in single file check when rpath has root folder #228

Merged
merged 5 commits into from Aug 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions HISTORY.rst
Expand Up @@ -3,6 +3,11 @@
Release History
===============

0.0.27 (2018-08-08)
+++++++++++++++++++
* Fixed bug in single file check
* Added Python2 exception compatibility

0.0.26 (2018-08-03)
+++++++++++++++++++
* Fixed bug due to not importing errno
Expand Down
2 changes: 1 addition & 1 deletion azure/datalake/store/__init__.py
Expand Up @@ -6,7 +6,7 @@
# license information.
# --------------------------------------------------------------------------

__version__ = "0.0.26"
__version__ = "0.0.27"

from .core import AzureDLFileSystem
from .multithread import ADLDownloader
Expand Down
4 changes: 2 additions & 2 deletions azure/datalake/store/multithread.py
Expand Up @@ -24,7 +24,7 @@

from io import open
from .core import AzureDLPath, _fetch_range
from .exceptions import FileExistsError
from .exceptions import FileExistsError, FileNotFoundError
from .transfer import ADLTransferClient
from .utils import datadir, read_block, tokenize

Expand Down Expand Up @@ -196,7 +196,7 @@ def _setup(self):
else:
rfiles = self.client._adlfs.glob(self.rpath, details=True, invalidate_cache=True)

if len(rfiles) == 1 and os.path.abspath(rfiles[0]['name']) == os.path.abspath(self.rpath):
if len(rfiles) == 1 and self.client._adlfs.info(self.rpath)['type'] == 'FILE':
if os.path.exists(self.lpath) and os.path.isdir(self.lpath):
file_pairs = [(os.path.join(self.lpath, os.path.basename(rfiles[0]['name'] + '.inprogress')),
rfiles[0])]
Expand Down
8 changes: 8 additions & 0 deletions tests/test_multithread.py
Expand Up @@ -405,3 +405,11 @@ def test_save_up(local_files, azure):
up.save(keep=False)
alluploads = ADLUploader.load()
assert up.hash not in alluploads

@my_vcr.use_cassette
def test_download_root_folder(azure, tempdir):
with setup_tree(azure):
rpath = AzureDLPath('/'/test_dir / 'data/single/single'/ 'single.txt')
ADLDownloader(azure, rpath=rpath, lpath=tempdir)
assert os.path.isfile(os.path.join(tempdir, 'single.txt'))