Skip to content

Commit 5904204

Browse files
committed
Correct the order of operations to ensure that failed attempts aren't cached and are thus retried on subsequent operations.
Closes #304
1 parent b1e746c commit 5904204

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

distutils/dir_util.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ def wrap(self, func):
3232
def wrapper(path, *args, **kwargs):
3333
if path.absolute() in self:
3434
return
35+
result = func(path, *args, **kwargs)
3536
self.add(path.absolute())
36-
return func(path, *args, **kwargs)
37+
return result
3738

3839
return wrapper
3940

distutils/tests/test_dir_util.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ def test_copy_tree_exception_in_listdir(self):
112112
src = self.tempdirs[-1]
113113
dir_util.copy_tree(src, None)
114114

115-
@pytest.mark.xfail(reason="#304")
116115
def test_mkpath_exception_uncached(self, monkeypatch, tmp_path):
117116
"""
118117
Caching should not remember failed attempts.

0 commit comments

Comments
 (0)