MCPcopy
hub / github.com/alibaba/EasyCV / test_move

Method test_move

tests/test_file/test_file_io.py:70–88  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

68 self.assertFalse(io.exists(test_fake_file))
69
70 def test_move(self):
71 tmp_name = uuid.uuid4().hex
72 tmp_file_name = '%s.txt' % tmp_name
73 tmp_file_path = os.path.join(TMP_DIR_OSS, tmp_file_name)
74 target_dir = os.path.join(TMP_DIR_OSS + 'test_move1_%s' % tmp_name)
75 with io.open(tmp_file_path, 'a') as f:
76 f.write('aaa')
77
78 # test move file
79 target_path = os.path.join(target_dir, tmp_file_name)
80 io.move(tmp_file_path, target_path)
81 self.assertFalse(io.exists(tmp_file_path))
82 self.assertTrue(io.exists(target_path))
83 # test move dir
84 target_dir2 = os.path.join(TMP_DIR_OSS, 'test_move2_%s' % tmp_name)
85 io.move(target_dir, target_dir2)
86 self.assertFalse(io.exists(target_dir))
87 self.assertTrue(io.exists(os.path.join(target_dir2, tmp_file_name)))
88 io.remove(target_dir2)
89
90 def test_copy(self):
91 # test copy file from oss to local

Callers

nothing calls this directly

Calls 5

writeMethod · 0.80
openMethod · 0.45
moveMethod · 0.45
existsMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected