https://github.com/python/cpython/commit/d99ffc5a4b74e541c59b0e8ca034b74d5a76a730
commit: d99ffc5a4b74e541c59b0e8ca034b74d5a76a730
branch: 3.12
author: Miss Islington (bot) <[email protected]>
committer: encukou <[email protected]>
date: 2024-03-22T10:24:06Z
summary:

[3.12] gh-117127: glob tests: Reopen dir_fd to pick up directory changes 
(GH-117128) (GH-117150)

gh-117127: glob tests: Reopen dir_fd to pick up directory changes (GH-117128)
(cherry picked from commit 42ae924d278c48a719fb0ab86357f3235a9f7ab9)

Co-authored-by: Petr Viktorin <[email protected]>

files:
M Lib/test/test_glob.py

diff --git a/Lib/test/test_glob.py b/Lib/test/test_glob.py
index faf5bd85cc816b..e11ea81a7d46e5 100644
--- a/Lib/test/test_glob.py
+++ b/Lib/test/test_glob.py
@@ -40,6 +40,11 @@ def setUp(self):
             os.symlink(self.norm('broken'), self.norm('sym1'))
             os.symlink('broken', self.norm('sym2'))
             os.symlink(os.path.join('a', 'bcd'), self.norm('sym3'))
+        self.open_dirfd()
+
+    def open_dirfd(self):
+        if self.dir_fd is not None:
+            os.close(self.dir_fd)
         if {os.open, os.stat} <= os.supports_dir_fd and os.scandir in 
os.supports_fd:
             self.dir_fd = os.open(self.tempdir, os.O_RDONLY | os.O_DIRECTORY)
         else:
@@ -349,6 +354,10 @@ def test_glob_non_directory(self):
     def test_glob_named_pipe(self):
         path = os.path.join(self.tempdir, 'mypipe')
         os.mkfifo(path)
+
+        # gh-117127: Reopen self.dir_fd to pick up directory changes
+        self.open_dirfd()
+
         self.assertEqual(self.rglob('mypipe'), [path])
         self.assertEqual(self.rglob('mypipe*'), [path])
         self.assertEqual(self.rglob('mypipe', ''), [])

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to