[Python-checkins] [3.9] bpo-42782: fix broken shutil test (GH-31971)

orsenthil webhook-mailer at python.org
Thu Mar 17 22:46:05 EDT 2022


https://github.com/python/cpython/commit/e808c9d5c78e5a7a9d804eced013a02c0c7df1a5
commit: e808c9d5c78e5a7a9d804eced013a02c0c7df1a5
branch: 3.9
author: Jelle Zijlstra <jelle.zijlstra at gmail.com>
committer: orsenthil <senthilx at amazon.com>
date: 2022-03-17T19:45:40-07:00
summary:

[3.9] bpo-42782: fix broken shutil test (GH-31971)

We were using os_helper, which doesn't exist on 3.9. This wasn't
caught because the test is only run as root. I confirmed that when
run as root, the test previously failed and now passes.

files:
M Lib/test/test_shutil.py

diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
index 85cac94dfec78..3890df93bbccd 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -2154,7 +2154,7 @@ def test_move_dir_permission_denied(self):
 
             # Create a file and keep the directory immutable
             os.lchflags(TESTFN_SRC, stat.UF_OPAQUE)
-            os_helper.create_empty_file(os.path.join(TESTFN_SRC, 'child'))
+            support.create_empty_file(os.path.join(TESTFN_SRC, 'child'))
             os.lchflags(TESTFN_SRC, stat.SF_IMMUTABLE)
 
             # Testing on a non-empty immutable directory
@@ -2164,10 +2164,10 @@ def test_move_dir_permission_denied(self):
         finally:
             if os.path.exists(TESTFN_SRC):
                 os.lchflags(TESTFN_SRC, stat.UF_OPAQUE)
-                os_helper.rmtree(TESTFN_SRC)
+                support.rmtree(TESTFN_SRC)
             if os.path.exists(TESTFN_DST):
                 os.lchflags(TESTFN_DST, stat.UF_OPAQUE)
-                os_helper.rmtree(TESTFN_DST)
+                support.rmtree(TESTFN_DST)
 
 
 class TestCopyFile(unittest.TestCase):



More information about the Python-checkins mailing list