mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-116401: Fix blocking os.fwalk() and shutil.rmtree() on opening a named pipe (GH-116421)
This commit is contained in:
parent
8332e85b2f
commit
aa7bcf284f
6 changed files with 113 additions and 8 deletions
|
@ -667,6 +667,23 @@ class TestRmTree(BaseTest, unittest.TestCase):
|
|||
finally:
|
||||
shutil.rmtree(TESTFN, ignore_errors=True)
|
||||
|
||||
@unittest.skipUnless(hasattr(os, "mkfifo"), 'requires os.mkfifo()')
|
||||
@unittest.skipIf(sys.platform == "vxworks",
|
||||
"fifo requires special path on VxWorks")
|
||||
def test_rmtree_on_named_pipe(self):
|
||||
os.mkfifo(TESTFN)
|
||||
try:
|
||||
with self.assertRaises(NotADirectoryError):
|
||||
shutil.rmtree(TESTFN)
|
||||
self.assertTrue(os.path.exists(TESTFN))
|
||||
finally:
|
||||
os.unlink(TESTFN)
|
||||
|
||||
os.mkdir(TESTFN)
|
||||
os.mkfifo(os.path.join(TESTFN, 'mypipe'))
|
||||
shutil.rmtree(TESTFN)
|
||||
self.assertFalse(os.path.exists(TESTFN))
|
||||
|
||||
@unittest.skipIf(sys.platform[:6] == 'cygwin',
|
||||
"This test can't be run on Cygwin (issue #1071513).")
|
||||
@os_helper.skip_if_dac_override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue