mirror of
https://github.com/huggingface/kernels.git
synced 2025-10-20 12:33:46 +08:00
revision -> branch
This commit is contained in:
@ -70,7 +70,7 @@ def main():
|
||||
help="Repository ID to use to upload to the Hugging Face Hub",
|
||||
)
|
||||
upload_parser.add_argument(
|
||||
"--revision",
|
||||
"--branch",
|
||||
type=None,
|
||||
help="If set, the upload will be made to a particular branch of the provided `repo_id`.",
|
||||
)
|
||||
@ -223,7 +223,7 @@ def upload_kernels(args):
|
||||
upload_folder(
|
||||
repo_id=repo_id,
|
||||
folder_path=build_dir,
|
||||
revision=args.revision,
|
||||
revision=args.branch,
|
||||
path_in_repo="build",
|
||||
delete_patterns=list(delete_patterns),
|
||||
commit_message="Build uploaded using `kernels`.",
|
||||
|
@ -30,7 +30,7 @@ class UploadArgs:
|
||||
kernel_dir: None
|
||||
repo_id: None
|
||||
private: False
|
||||
revision: None
|
||||
branch: None
|
||||
|
||||
|
||||
def next_filename(path: Path) -> Path:
|
||||
@ -71,15 +71,15 @@ def get_filenames_from_a_repo(repo_id: str) -> List[str]:
|
||||
|
||||
@pytest.mark.token
|
||||
@pytest.mark.is_staging_test
|
||||
@pytest.mark.parametrize("revision", (None, "foo"))
|
||||
def test_kernel_upload_works_as_expected(revision):
|
||||
@pytest.mark.parametrize("branch", (None, "foo"))
|
||||
def test_kernel_upload_works_as_expected(branch):
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
path = f"{tmpdir}/build/torch-universal/upload_test"
|
||||
build_dir = Path(path)
|
||||
build_dir.mkdir(parents=True, exist_ok=True)
|
||||
script_path = build_dir / "foo.py"
|
||||
script_path.write_text(PY_CONTENT)
|
||||
upload_kernels(UploadArgs(tmpdir, REPO_ID, False, revision))
|
||||
upload_kernels(UploadArgs(tmpdir, REPO_ID, False, branch))
|
||||
|
||||
repo_filenames = get_filenames_from_a_repo(REPO_ID)
|
||||
assert any(str(script_path.name) for f in repo_filenames)
|
||||
|
Reference in New Issue
Block a user