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

Method test_patch_create_repo

tests/utils/test_hf_util.py:209–232  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

207 self.assertTrue(local_dir is not None)
208
209 def test_patch_create_repo(self):
210 with patch_context():
211 from huggingface_hub import create_repo
212 repo_url: RepoUrl = create_repo(self.create_model_name)
213 logger.info('patch create repo result: ' + repo_url.repo_id)
214 self.assertTrue(repo_url is not None)
215 from huggingface_hub import upload_folder
216 commit_info: CommitInfo = upload_folder(
217 repo_id=self.create_model_name,
218 folder_path=self.test_folder,
219 path_in_repo='')
220 logger.info('patch create repo result: ' + commit_info.commit_url)
221 self.assertTrue(commit_info is not None)
222 from huggingface_hub import file_exists
223 time.sleep(1)
224 self.assertTrue(file_exists(self.create_model_name, '1.json'))
225 from huggingface_hub import upload_file
226 commit_info: CommitInfo = upload_file(
227 path_or_fileobj=self.test_file2,
228 path_in_repo='test_folder2',
229 repo_id=self.create_model_name)
230 time.sleep(1)
231 self.assertTrue(
232 file_exists(self.create_model_name, 'test_folder2/2.json'))
233
234 def test_who_am_i(self):
235 with patch_context():

Callers

nothing calls this directly

Calls 5

patch_contextFunction · 0.90
create_repoFunction · 0.85
upload_folderFunction · 0.85
upload_fileFunction · 0.85
infoMethod · 0.80

Tested by

no test coverage detected