MCPcopy Index your code
hub / github.com/python/cpython / test_walk_named_pipe2

Method test_walk_named_pipe2

Lib/test/test_os/test_os.py:1892–1919  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1890 @unittest.skipIf(sys.platform == "vxworks",
1891 "fifo requires special path on VxWorks")
1892 def test_walk_named_pipe2(self):
1893 path = os_helper.TESTFN + '-dir'
1894 os.mkdir(path)
1895 self.addCleanup(shutil.rmtree, path)
1896 os.mkfifo(os.path.join(path, 'mypipe'))
1897
1898 errors = []
1899 walk_it = self.walk(path, onerror=errors.append)
1900 next(walk_it)
1901 self.assertRaises(StopIteration, next, walk_it)
1902 self.assertEqual(errors, [])
1903
1904 errors = []
1905 walk_it = self.walk(path, onerror=errors.append)
1906 root, dirs, files = next(walk_it)
1907 self.assertEqual(root, path)
1908 self.assertEqual(dirs, [])
1909 self.assertEqual(files, ['mypipe'])
1910 dirs.extend(files)
1911 files.clear()
1912 if self.is_fwalk:
1913 self.assertRaises(NotADirectoryError, next, walk_it)
1914 self.assertRaises(StopIteration, next, walk_it)
1915 if self.is_fwalk:
1916 self.assertEqual(errors, [])
1917 else:
1918 self.assertEqual(len(errors), 1, errors)
1919 self.assertIsInstance(errors[0], NotADirectoryError)
1920
1921 def test_walk_many_open_files(self):
1922 depth = 30

Callers

nothing calls this directly

Calls 9

walkMethod · 0.95
addCleanupMethod · 0.80
assertIsInstanceMethod · 0.80
mkdirMethod · 0.45
joinMethod · 0.45
assertRaisesMethod · 0.45
assertEqualMethod · 0.45
extendMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected