(
url_or_id: str, md5: str, options: list[str] | None = None
)
| 19 | |
| 20 | |
| 21 | def _test_cli_with_md5( |
| 22 | url_or_id: str, md5: str, options: list[str] | None = None |
| 23 | ) -> None: |
| 24 | # We can't use NamedTemporaryFile because Windows doesn't allow the subprocess |
| 25 | # to write the file created by the parent process. |
| 26 | with tempfile.TemporaryDirectory() as d: |
| 27 | file_path = os.path.join(d, "file") |
| 28 | cmd = ["gdown", "--no-cookies", url_or_id, "-O", file_path] |
| 29 | if options is not None: |
| 30 | cmd.extend(options) |
| 31 | subprocess.call(cmd) |
| 32 | assert os.path.exists(file_path) |
| 33 | _assert_filehash(path=file_path, hash=f"md5:{md5}") |
| 34 | |
| 35 | |
| 36 | def _test_cli_with_content(url_or_id: str, content: str) -> None: |
no test coverage detected
searching dependent graphs…