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

Method test_w_source_open_fails

Lib/test/test_shutil.py:3025–3033  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3023 return self._suppress_at_exit
3024
3025 def test_w_source_open_fails(self):
3026 def _open(filename, mode='r'):
3027 if filename == 'srcfile':
3028 raise OSError('Cannot open "srcfile"')
3029 assert 0 # shouldn't reach here.
3030
3031 with support.swap_attr(shutil, 'open', _open):
3032 with self.assertRaises(OSError):
3033 shutil.copyfile('srcfile', 'destfile')
3034
3035 @unittest.skipIf(MACOS, "skipped on macOS")
3036 def test_w_dest_open_fails(self):

Callers

nothing calls this directly

Calls 2

copyfileMethod · 0.80
assertRaisesMethod · 0.45

Tested by

no test coverage detected