diff options
Diffstat (limited to 'Lib/test/test_shutil.py')
-rw-r--r-- | Lib/test/test_shutil.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py index 493c7e5f9f..e2574253d9 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -1249,6 +1249,15 @@ class TestCopy(BaseTest, unittest.TestCase): # Make sure file is not corrupted. self.assertEqual(read_file(src_file), 'foo') + @unittest.skipIf(MACOS or _winapi, 'On MACOS and Windows the errors are not confusing (though different)') + def test_copyfile_nonexistent_dir(self): + # Issue 43219 + src_dir = self.mkdtemp() + src_file = os.path.join(src_dir, 'foo') + dst = os.path.join(src_dir, 'does_not_exist/') + write_file(src_file, 'foo') + self.assertRaises(FileNotFoundError, shutil.copyfile, src_file, dst) + class TestArchives(BaseTest, unittest.TestCase): |