Skip to content

Commit 6c77fdf

Browse files
Ashok93fmassa
authored andcommitted
Test - Added downloaded directory not empty check in test_datasets_utils (#844)
1 parent 144ca42 commit 6c77fdf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

test/test_datasets_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import shutil
23
import tempfile
34
import torch
@@ -11,12 +12,14 @@ def test_download_url(self):
1112
temp_dir = tempfile.mkdtemp()
1213
url = "http://github.com/pytorch/vision/archive/master.zip"
1314
utils.download_url(url, temp_dir)
15+
assert not len(os.listdir(temp_dir)) == 0, 'The downloaded root directory is empty after download.'
1416
shutil.rmtree(temp_dir)
1517

1618
def test_download_url_retry_http(self):
1719
temp_dir = tempfile.mkdtemp()
1820
url = "https://github.com/pytorch/vision/archive/master.zip"
1921
utils.download_url(url, temp_dir)
22+
assert not len(os.listdir(temp_dir)) == 0, 'The downloaded root directory is empty after download.'
2023
shutil.rmtree(temp_dir)
2124

2225

0 commit comments

Comments
 (0)