Commit 6c77fdf6 authored by Ashok M's avatar Ashok M Committed by Francisco Massa
Browse files

Test - Added downloaded directory not empty check in test_datasets_utils (#844)

parent 144ca427
import os
import shutil import shutil
import tempfile import tempfile
import torch import torch
...@@ -11,12 +12,14 @@ class Tester(unittest.TestCase): ...@@ -11,12 +12,14 @@ class Tester(unittest.TestCase):
temp_dir = tempfile.mkdtemp() temp_dir = tempfile.mkdtemp()
url = "http://github.com/pytorch/vision/archive/master.zip" url = "http://github.com/pytorch/vision/archive/master.zip"
utils.download_url(url, temp_dir) utils.download_url(url, temp_dir)
assert not len(os.listdir(temp_dir)) == 0, 'The downloaded root directory is empty after download.'
shutil.rmtree(temp_dir) shutil.rmtree(temp_dir)
def test_download_url_retry_http(self): def test_download_url_retry_http(self):
temp_dir = tempfile.mkdtemp() temp_dir = tempfile.mkdtemp()
url = "https://github.com/pytorch/vision/archive/master.zip" url = "https://github.com/pytorch/vision/archive/master.zip"
utils.download_url(url, temp_dir) utils.download_url(url, temp_dir)
assert not len(os.listdir(temp_dir)) == 0, 'The downloaded root directory is empty after download.'
shutil.rmtree(temp_dir) shutil.rmtree(temp_dir)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment