Avoid race condition (#31973)

* [test_all] hub

* remove delete

* remove delete

* remove delete

* remove delete

* remove delete

* remove delete

* [test_all]

* [test_all]

* [test_all]

* [test_all]

* [test_all]

* [test_all]

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
Yih-Dar
2024-07-15 17:56:24 +02:00
committed by GitHub
parent 11efb4fc09
commit a1a34657d4
8 changed files with 80 additions and 32 deletions

View File

@@ -96,8 +96,11 @@ class ImageProcessorPushToHubTester(unittest.TestCase):
for k, v in image_processor.__dict__.items():
self.assertEqual(v, getattr(new_image_processor, k))
# Reset repo
delete_repo(token=self._token, repo_id="test-image-processor")
try:
# Reset repo
delete_repo(token=self._token, repo_id="test-image-processor")
except: # noqa E722
pass
# Push to hub via save_pretrained
with tempfile.TemporaryDirectory() as tmp_dir:
@@ -117,8 +120,11 @@ class ImageProcessorPushToHubTester(unittest.TestCase):
for k, v in image_processor.__dict__.items():
self.assertEqual(v, getattr(new_image_processor, k))
# Reset repo
delete_repo(token=self._token, repo_id="valid_org/test-image-processor")
try:
# Reset repo
delete_repo(token=self._token, repo_id="valid_org/test-image-processor")
except: # noqa E722
pass
# Push to hub via save_pretrained
with tempfile.TemporaryDirectory() as tmp_dir: