MCPcopy Create free account
hub / github.com/modelscope/modelscope / setUp

Method setUp

tests/utils/test_file_utils.py:10–29  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

8class TestCopyTree(unittest.TestCase):
9
10 def setUp(self):
11 self.tmp_dir = tempfile.TemporaryDirectory()
12 self.tmp2_dir = tempfile.TemporaryDirectory()
13 dir_path = self.tmp_dir.name
14 print(f'self.tmp_dir: {self.tmp_dir.name}')
15 print(f'self.tmp_dir2: {self.tmp2_dir.name}')
16 fnames = ['1.py', '2.py', '3.py']
17 self.folders = ['.', 'a', 'b', 'c']
18 folder_dirs = [
19 os.path.join(dir_path, folder) for folder in self.folders
20 ]
21 for folder in folder_dirs:
22 os.makedirs(folder, exist_ok=True)
23 for fname in fnames:
24 fpath = os.path.join(folder, fname)
25 with open(fpath, 'w') as f:
26 f.write('hello world')
27
28 for folder in folder_dirs:
29 print(f'folder: {os.listdir(folder)}')
30
31 def tearDown(self):
32 self.tmp_dir.cleanup()

Callers

nothing calls this directly

Calls 2

printFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected