Skip to content

Commit df5523d

Browse files
committed
merge test file versions
1 parent 4d8bae7 commit df5523d

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

tests/trainer/test_trainer.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5306,7 +5306,6 @@ class TrainerIntegrationWithHubTester(unittest.TestCase):
53065306
@classmethod
53075307
def setUpClass(cls):
53085308
cls._token = TOKEN
5309-
HfFolder.save_token(TOKEN)
53105309

53115310
def test_push_to_hub(self):
53125311
with TemporaryHubRepo(token=self._token) as tmp_repo:
@@ -5491,14 +5490,10 @@ def test_push_to_hub_with_revision(self):
54915490
)
54925491
branch = "v1.0"
54935492
create_branch(repo_id=trainer.hub_model_id, branch=branch, token=self._token, exist_ok=True)
5494-
url = trainer.push_to_hub(revision=branch)
5493+
push_commit = trainer.push_to_hub(revision=branch)
54955494

5496-
# Extract branch from the url
5497-
re_search = re.search(r"tree/([^/]+)/", url)
5498-
self.assertIsNotNone(re_search)
5499-
5500-
branch_name = re_search.groups()[0]
5501-
self.assertEqual(branch_name, branch)
5495+
commits = list_repo_commits(repo_id=trainer.hub_model_id, revision=branch, token=self._token)
5496+
self.assertEqual(commits[0].commit_id, push_commit.oid)
55025497

55035498

55045499
@require_torch

0 commit comments

Comments
 (0)