Skip to content

Commit

Permalink
skip test if download problem
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Jan 3, 2020
1 parent 288722c commit 138e222
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/test_epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import filecmp
import urllib.request
from random import randint
from pathlib import Path

import pytest
from pytest import approx
Expand Down Expand Up @@ -259,8 +260,13 @@ def test_findepochrange_cdfepoch16():
def test_latest_leapsecs():
# Check that the built in leapseconds table is the latest one
local = epochs.LEAPSEC_FILE
remote, _ = urllib.request.urlretrieve('https://cdf.gsfc.nasa.gov/html/CDFLeapSeconds.txt')
assert filecmp.cmp(local, remote)
try:
remote, _ = urllib.request.urlretrieve('https://cdf.gsfc.nasa.gov/html/CDFLeapSeconds.txt')
except Exception as excp:
pytest.skip('problem downloading leapseconds file: {}'.format(excp))
if not filecmp.cmp(local, remote):
feedback = Path(remote).read_text(errors='ignore')
pytest.skip('problem downloading leapseconds file: \n\n{}'.format(feedback))


if __name__ == '__main__':
Expand Down

0 comments on commit 138e222

Please sign in to comment.