Skip to content

Commit 4ce74c2

Browse files
committed
Revert to original test
1 parent 6d0eac5 commit 4ce74c2

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

Lib/test/test_os.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3087,7 +3087,7 @@ def test_stat_unlink_race(self):
30873087

30883088
@support.requires_subprocess()
30893089
def test_stat_inaccessible_file(self):
3090-
filename = os.path.abspath("test_stat_inaccessible_file.txt")
3090+
filename = os_helper.TESTFN
30913091
ICACLS = os.path.expandvars(r"%SystemRoot%\System32\icacls.exe")
30923092

30933093
with open(filename, "wb") as f:
@@ -3109,22 +3109,6 @@ def test_stat_inaccessible_file(self):
31093109
pass
31103110
self.skipTest("Unable to create inaccessible file")
31113111

3112-
# We should now not be able to open the file. If we can, the test isn't
3113-
# going to work. A few retries to try and catch slow updates
3114-
try:
3115-
for _ in range(5):
3116-
with open(filename, "rb") as f:
3117-
pass
3118-
time.sleep(0.5)
3119-
except PermissionError:
3120-
pass
3121-
else:
3122-
try:
3123-
os.unlink(filename)
3124-
except Exception:
3125-
pass
3126-
self.skipTest("Still had access to inaccessible file")
3127-
31283112
def cleanup():
31293113
# Give delete permission. We are the file owner, so we can do this
31303114
# even though we removed all permissions earlier.

0 commit comments

Comments
 (0)