Skip to content

Commit

Permalink
Merge pull request #12 from mandarons/feature
Browse files Browse the repository at this point in the history
Fixes #11
  • Loading branch information
mandarons authored Apr 8, 2021
2 parents fd1e17d + ac7e50d commit fa5df07
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -440,5 +440,4 @@ valid-metaclass-classmethod-first-arg=mcs
# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
overgeneral-exceptions=StandardError,
Exception,
BaseException
2 changes: 1 addition & 1 deletion src/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def download_file(item, local_file, verbose=False):
copyfileobj(response.raw, file_out)
item_modified_time = time.mktime(item.date_modified.timetuple())
os.utime(local_file, (item_modified_time, item_modified_time))
except (exceptions.PyiCloudAPIResponseException, FileNotFoundError) as e:
except (exceptions.PyiCloudAPIResponseException, FileNotFoundError, Exception) as e:
print(f'Failed to download {local_file}: {str(e)}')
return False
return True
Expand Down
3 changes: 3 additions & 0 deletions tests/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ def test_download_file_invalids(self):
self.assertFalse(sync.download_file(item=self.file_item,
local_file=os.path.join(self.destination_path, 'non-existent-folder',
self.file_name)))
with patch.object(self.file_item, 'open') as mock_item:
mock_item.side_effect = KeyError('data_token')
self.assertFalse(sync.download_file(item=self.file_item, local_file=self.local_file_path))

def test_process_file_valids(self):
files = set()
Expand Down

0 comments on commit fa5df07

Please sign in to comment.