@@ -880,6 +880,48 @@ def _filter(src, names):
880880shutil.rmtree(src_dir)
881881shutil.rmtree(os.path.dirname(dst_dir))
882882883+deftest_copytree_arg_types_of_ignore(self):
884+join=os.path.join
885+exists=os.path.exists
886+887+tmp_dir=self.mkdtemp()
888+src_dir=join(tmp_dir, "source")
889+890+os.mkdir(join(src_dir))
891+os.mkdir(join(src_dir, 'test_dir'))
892+os.mkdir(os.path.join(src_dir, 'test_dir', 'subdir'))
893+write_file((src_dir, 'test_dir', 'subdir', 'test.txt'), '456')
894+895+invokations= []
896+897+def_ignore(src, names):
898+invokations.append(src)
899+self.assertIsInstance(src, str)
900+self.assertIsInstance(names, list)
901+self.assertEqual(len(names), len(set(names)))
902+fornameinnames:
903+self.assertIsInstance(name, str)
904+return []
905+906+dst_dir=join(self.mkdtemp(), 'destination')
907+shutil.copytree(src_dir, dst_dir, ignore=_ignore)
908+self.assertTrue(exists(join(dst_dir, 'test_dir', 'subdir',
909+'test.txt')))
910+911+dst_dir=join(self.mkdtemp(), 'destination')
912+shutil.copytree(pathlib.Path(src_dir), dst_dir, ignore=_ignore)
913+self.assertTrue(exists(join(dst_dir, 'test_dir', 'subdir',
914+'test.txt')))
915+916+dst_dir=join(self.mkdtemp(), 'destination')
917+src_dir_entry=list(os.scandir(tmp_dir))[0]
918+self.assertIsInstance(src_dir_entry, os.DirEntry)
919+shutil.copytree(src_dir_entry, dst_dir, ignore=_ignore)
920+self.assertTrue(exists(join(dst_dir, 'test_dir', 'subdir',
921+'test.txt')))
922+923+self.assertEqual(len(invokations), 9)
924+883925deftest_copytree_retains_permissions(self):
884926tmp_dir=tempfile.mkdtemp()
885927src_dir=os.path.join(tmp_dir, 'source')