(self)
| 3034 | |
| 3035 | @unittest.skipIf(MACOS, "skipped on macOS") |
| 3036 | def test_w_dest_open_fails(self): |
| 3037 | srcfile = self.Faux() |
| 3038 | |
| 3039 | def _open(filename, mode='r'): |
| 3040 | if filename == 'srcfile': |
| 3041 | return srcfile |
| 3042 | if filename == 'destfile': |
| 3043 | raise OSError('Cannot open "destfile"') |
| 3044 | assert 0 # shouldn't reach here. |
| 3045 | |
| 3046 | with support.swap_attr(shutil, 'open', _open): |
| 3047 | shutil.copyfile('srcfile', 'destfile') |
| 3048 | self.assertTrue(srcfile._entered) |
| 3049 | self.assertTrue(srcfile._exited_with[0] is OSError) |
| 3050 | self.assertEqual(srcfile._exited_with[1].args, |
| 3051 | ('Cannot open "destfile"',)) |
| 3052 | |
| 3053 | @unittest.skipIf(MACOS, "skipped on macOS") |
| 3054 | def test_w_dest_close_fails(self): |
nothing calls this directly
no test coverage detected