(self)
| 3371 | return shutil._fastcopy_sendfile(fsrc, fdst) |
| 3372 | |
| 3373 | def test_file2file_not_supported(self): |
| 3374 | # Emulate a case where sendfile() only support file->socket |
| 3375 | # fds. In such a case copyfile() is supposed to skip the |
| 3376 | # fast-copy attempt from then on. |
| 3377 | assert shutil._USE_CP_SENDFILE |
| 3378 | try: |
| 3379 | with unittest.mock.patch( |
| 3380 | self.PATCHPOINT, |
| 3381 | side_effect=OSError(errno.ENOTSOCK, "yo")) as m: |
| 3382 | with self.get_files() as (src, dst): |
| 3383 | with self.assertRaises(_GiveupOnFastCopy): |
| 3384 | shutil._fastcopy_sendfile(src, dst) |
| 3385 | assert m.called |
| 3386 | assert not shutil._USE_CP_SENDFILE |
| 3387 | |
| 3388 | with unittest.mock.patch(self.PATCHPOINT) as m: |
| 3389 | shutil.copyfile(TESTFN, TESTFN2) |
| 3390 | assert not m.called |
| 3391 | finally: |
| 3392 | shutil._USE_CP_SENDFILE = True |
| 3393 | |
| 3394 | |
| 3395 | @unittest.skipUnless(shutil._USE_CP_COPY_FILE_RANGE, "os.copy_file_range() not supported") |
nothing calls this directly
no test coverage detected