Skip to content

Commit

Permalink
Merge pull request #85 from ziao-guo/main
Browse files Browse the repository at this point in the history
Fix macos test via adopting a small VOC dataset.
  • Loading branch information
ziao-guo authored Nov 8, 2023
2 parents 675d256 + f8bd799 commit 56b5f10
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

macos:

runs-on: macos-latest
runs-on: macos-12
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
pytest --cov=pygmtools --cov-report=xml --cov-append
windows:

runs-on: windows-latest
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -111,4 +111,4 @@ jobs:
- name: Test with pytest. They are divided into two runs because MindSpore will interfere with Paddle.
run: |
pytest --cov=pygmtools --cov-report=xml --backend=mindspore tests/test_classic_solvers.py
pytest --cov=pygmtools --cov-report=xml --cov-append
pytest --cov=pygmtools --cov-report=xml --cov-append
8 changes: 4 additions & 4 deletions pygmtools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1255,25 +1255,25 @@ def _download(filename, url, md5, retries, to_cache=True):
shutil.copyfileobj(content, file)
except requests.exceptions.ConnectionError as err:
print('Warning: Network error. Retrying...\n', err)
return download(filename, url, md5, retries - 1)
return download(filename, url, md5, retries - 1, to_cache)
elif retries % 3 == 2:
try:
asyncio.run(_asyncdownload(filename, url))
except:
return _download(filename, url, md5, retries - 1)
return _download(filename, url, md5, retries - 1, to_cache)
else:
try:
urllib.request.urlretrieve(url, filename)
except:
return _download(filename, url, md5, retries - 1)
return _download(filename, url, md5, retries - 1, to_cache)

if md5 is not None:
md5_returned = _get_md5(filename)
if md5 != md5_returned:
print('Warning: MD5 check failed for the downloaded content. Retrying...')
os.remove(filename)
time.sleep(1)
return _download(filename, url, md5, retries - 1)
return _download(filename, url, md5, retries - 1, to_cache)
return filename


Expand Down
1 change: 1 addition & 0 deletions tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def test_dataset_and_benchmark():
voc_cfg_dict['SET_SPLIT'] = dataset_cfg.PascalVOC.SET_SPLIT
voc_cfg_dict['CLASSES'] = dataset_cfg.PascalVOC.CLASSES
voc_cfg_dict['CACHE_PATH'] = dataset_cfg.CACHE_PATH
voc_cfg_dict['URL'] = 'https://drive.google.com/u/0/uc?id=1TLBN4dnf_THmN3kNINMO0DpHhcBDqzcI&export=download'
dict_list.append(voc_cfg_dict)

willow_cfg_dict = dict()
Expand Down

0 comments on commit 56b5f10

Please sign in to comment.