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

Method test_handling_bad_descriptor

Lib/test/test_pathlib/test_pathlib.py:3277–3296  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3275 "Bad file descriptor in /dev/fd affects only macOS")
3276 @needs_posix
3277 def test_handling_bad_descriptor(self):
3278 try:
3279 file_descriptors = list(pathlib.Path('/dev/fd').rglob("*"))[3:]
3280 if not file_descriptors:
3281 self.skipTest("no file descriptors - issue was not reproduced")
3282 # Checking all file descriptors because there is no guarantee
3283 # which one will fail.
3284 for f in file_descriptors:
3285 f.exists()
3286 f.is_dir()
3287 f.is_file()
3288 f.is_symlink()
3289 f.is_block_device()
3290 f.is_char_device()
3291 f.is_fifo()
3292 f.is_socket()
3293 except OSError as e:
3294 if e.errno == errno.EBADF:
3295 self.fail("Bad file descriptor not handled.")
3296 raise
3297
3298 @needs_posix
3299 def test_from_uri_posix(self):

Callers

nothing calls this directly

Calls 12

listClass · 0.85
skipTestMethod · 0.80
is_block_deviceMethod · 0.80
is_char_deviceMethod · 0.80
is_fifoMethod · 0.80
is_socketMethod · 0.80
rglobMethod · 0.45
existsMethod · 0.45
is_dirMethod · 0.45
is_fileMethod · 0.45
is_symlinkMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected