From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 12 Sep 2023 02:00:36 +0000 (-0700) Subject: [3.11] gh-109295: Fix test_os.test_access_denied() for TEMP=cwd (GH-109299) (#109303) X-Git-Tag: v3.11.6~101 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5d47fb186e7f2689fec89c7bfd72448ad4d352ca;p=thirdparty%2FPython%2Fcpython.git [3.11] gh-109295: Fix test_os.test_access_denied() for TEMP=cwd (GH-109299) (#109303) 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 --- diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index aa414ca14889..1e1980e3ac47 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -726,7 +726,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