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

Method test_w_source_close_fails

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

Source from the content-addressed store, hash-verified

3047
3048 @unittest.skipIf(MACOS, "skipped on macOS")
3049 def test_w_source_close_fails(self):
3050
3051 srcfile = self.Faux(True)
3052 destfile = self.Faux()
3053
3054 def _open(filename, mode='r'):
3055 if filename == 'srcfile':
3056 return srcfile
3057 if filename == 'destfile':
3058 return destfile
3059 assert 0 # shouldn't reach here.
3060
3061 with support.swap_attr(shutil, 'open', _open):
3062 with self.assertRaises(OSError):
3063 shutil.copyfile('srcfile', 'destfile')
3064 self.assertTrue(srcfile._entered)
3065 self.assertTrue(destfile._entered)
3066 self.assertFalse(destfile._raised)
3067 self.assertTrue(srcfile._exited_with[0] is None)
3068 self.assertTrue(srcfile._raised)
3069
3070
3071class TestCopyFileObj(unittest.TestCase):

Callers

nothing calls this directly

Calls 4

copyfileMethod · 0.80
assertTrueMethod · 0.80
assertFalseMethod · 0.80
assertRaisesMethod · 0.45

Tested by

no test coverage detected