MCPcopy Index your code
hub / github.com/python/cpython / test_copytree_custom_copy_function

Method test_copytree_custom_copy_function

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

Source from the content-addressed store, hash-verified

974 shutil.copytree(src_dir, dst_dir)
975
976 def test_copytree_custom_copy_function(self):
977 # See: https://bugs.python.org/issue35648
978 def custom_cpfun(a, b):
979 flag.append(None)
980 self.assertIsInstance(a, str)
981 self.assertIsInstance(b, str)
982 self.assertEqual(a, os.path.join(src, 'foo'))
983 self.assertEqual(b, os.path.join(dst, 'foo'))
984
985 flag = []
986 src = self.mkdtemp()
987 dst = tempfile.mktemp(dir=self.mkdtemp())
988 create_file(os.path.join(src, 'foo'))
989 shutil.copytree(src, dst, copy_function=custom_cpfun)
990 self.assertEqual(len(flag), 1)
991
992 # Issue #3002: copyfile and copytree block indefinitely on named pipes
993 @unittest.skipUnless(hasattr(os, "mkfifo"), 'requires os.mkfifo()')

Callers

nothing calls this directly

Calls 5

mkdtempMethod · 0.80
mktempMethod · 0.80
create_fileFunction · 0.70
joinMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected