Skip to content

Commit

Permalink
Stop using tempfile.NamedTemporaryFile in test_cached_download.py
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed Feb 2, 2024
1 parent 44a7ca5 commit 15ee504
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 0 additions & 2 deletions gdown/cached_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ def _assert_filehash(path, hash, quiet=False, blocksize=None):
hash_actual = _compute_filehash(path=path, algorithm=algorithm)

if hash_actual == hash:
if not quiet:
print(f"File hash matches: {path!r} == {hash!r}", file=sys.stderr)
return True

raise AssertionError(
Expand Down
8 changes: 5 additions & 3 deletions tests/test_cached_download.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import os
import tempfile

import gdown


def _cached_download(**kwargs):
url = "https://drive.google.com/uc?id=0B9P1L--7Wd2vU3VUVlFnbTgtS2c"
with tempfile.NamedTemporaryFile() as f:
for _ in range(2):
gdown.cached_download(url=url, path=f.name, **kwargs)
path = tempfile.mktemp()
for _ in range(2):
gdown.cached_download(url=url, path=path, **kwargs)
os.remove(path)


def test_cached_download_md5():
Expand Down

0 comments on commit 15ee504

Please sign in to comment.