]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-109295: Fix test_os.test_access_denied() for TEMP=cwd (GH-109299) (#109304)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 12 Sep 2023 14:23:03 +0000 (07:23 -0700)
committerGitHub <noreply@github.com>
Tue, 12 Sep 2023 14:23:03 +0000 (16:23 +0200)
gh-109295: Fix test_os.test_access_denied() for TEMP=cwd (GH-109299)

Fix test_os.test_access_denied() when the TEMP environment variable
is equal to the current working directory. Run the test using a
different filename, since self.fname already exists in this case.
(cherry picked from commit 7dedfd36dc16d9e1e15d7d0b0a636dd401a5a543)

Co-authored-by: Victor Stinner <vstinner@python.org>
Lib/test/test_os.py

index 9453742132667d7383259e28d84317064faf0fbb..3cc5a6aaafcf366dae19296e1a4197e86085c626 100644 (file)
@@ -737,7 +737,7 @@ class StatAttributeTests(unittest.TestCase):
         # denied. See issue 28075.
         # os.environ['TEMP'] should be located on a volume that
         # supports file ACLs.
-        fname = os.path.join(os.environ['TEMP'], self.fname)
+        fname = os.path.join(os.environ['TEMP'], self.fname + "_access")
         self.addCleanup(os_helper.unlink, fname)
         create_file(fname, b'ABC')
         # Deny the right to [S]YNCHRONIZE on the file to