Skip to content

Commit

Permalink
Handle nonexistent directories as well
Browse files Browse the repository at this point in the history
  • Loading branch information
taion committed Nov 23, 2016
1 parent af16e0e commit 30bdf9f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions flask_annex/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ def _clean_empty_dirs(self, key):
try:
os.rmdir(dir_name)
except OSError as e:
if e.errno != errno.ENOTEMPTY:
if e.errno == errno.ENOTEMPTY:
break
if e.errno != errno.ENOENT:
raise # pragma: no cover
break

key_dir_name = os.path.dirname(key_dir_name)

Expand Down
2 changes: 1 addition & 1 deletion tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ def test_delete_nonexistent(self, annex):

def test_delete_many(self, annex):
assert annex.list_keys('')
annex.delete_many(('foo/bar.txt', 'foo/baz.json', '@@nonexistent'))
annex.delete_many(('foo/bar.txt', 'foo/baz.json', 'foo/@@nonexistent'))
assert not annex.list_keys('')

0 comments on commit 30bdf9f

Please sign in to comment.