Skip to content

Commit

Permalink
Correct the order of operations to ensure that failed attempts aren't…
Browse files Browse the repository at this point in the history
… cached and are thus retried on subsequent operations.

Closes #304
  • Loading branch information
jaraco committed Oct 19, 2024
1 parent b1e746c commit 5904204
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 2 additions & 1 deletion distutils/dir_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ def wrap(self, func):
def wrapper(path, *args, **kwargs):
if path.absolute() in self:
return
result = func(path, *args, **kwargs)
self.add(path.absolute())
return func(path, *args, **kwargs)
return result

return wrapper

Expand Down
1 change: 0 additions & 1 deletion distutils/tests/test_dir_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ def test_copy_tree_exception_in_listdir(self):
src = self.tempdirs[-1]
dir_util.copy_tree(src, None)

@pytest.mark.xfail(reason="#304")
def test_mkpath_exception_uncached(self, monkeypatch, tmp_path):
"""
Caching should not remember failed attempts.
Expand Down

0 comments on commit 5904204

Please sign in to comment.