MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_w_dest_close_fails

Method test_w_dest_close_fails

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

Source from the content-addressed store, hash-verified

3026
3027 @unittest.skipIf(MACOS, "skipped on macOS")
3028 def test_w_dest_close_fails(self):
3029 srcfile = self.Faux()
3030 destfile = self.Faux(True)
3031
3032 def _open(filename, mode='r'):
3033 if filename == 'srcfile':
3034 return srcfile
3035 if filename == 'destfile':
3036 return destfile
3037 assert 0 # shouldn't reach here.
3038
3039 with support.swap_attr(shutil, 'open', _open):
3040 shutil.copyfile('srcfile', 'destfile')
3041 self.assertTrue(srcfile._entered)
3042 self.assertTrue(destfile._entered)
3043 self.assertTrue(destfile._raised)
3044 self.assertTrue(srcfile._exited_with[0] is OSError)
3045 self.assertEqual(srcfile._exited_with[1].args,
3046 ('Cannot close',))
3047
3048 @unittest.skipIf(MACOS, "skipped on macOS")
3049 def test_w_source_close_fails(self):

Callers

nothing calls this directly

Calls 3

copyfileMethod · 0.80
assertTrueMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected