Skip to content
This repository has been archived by the owner on Jun 16, 2018. It is now read-only.

Commit

Permalink
Merge pull request #172 from astrofrog/travis-container
Browse files Browse the repository at this point in the history
Switch to container-based Travis infrastructure
  • Loading branch information
astrofrog committed Oct 4, 2015
2 parents bf35bcb + 705e4b0 commit f9c956a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
17 changes: 11 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
language: python

# Setting sudo to false opts in to Travis-CI container-based builds.
sudo: false

# The apt packages below are needed for sphinx builds
addons:
apt:
packages:
- graphviz
- texlive-latex-extra
- dvipng

python:
- 2.6
- 2.7
Expand Down Expand Up @@ -65,12 +76,6 @@ before_install:
- export PATH=/home/travis/miniconda/bin:$PATH
- conda update --yes conda

# UPDATE APT-GET LISTINGS
- sudo apt-get update

# DOCUMENTATION DEPENDENCIES
- if [[ $SETUP_CMD == build_sphinx* ]]; then sudo apt-get install graphviz texlive-latex-extra dvipng; fi

# Make sure that interactive matplotlib backends work
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
Expand Down
16 changes: 15 additions & 1 deletion wcsaxes/datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Downloads the FITS files that are used in image testing and for building documentation.
"""

import time

from astropy.utils.data import download_file
from astropy.io import fits

Expand All @@ -11,13 +14,24 @@
'fetch_bolocam_hdu',
]

MAX_RETRIES = 10
TIME_BETWEEN_RETRIES = 5
URL = 'http://data.astropy.org/'


def fetch_hdu(filename, cache=True):
"""Download a FITS file to the cache and open HDU 0.
"""
path = download_file(URL + filename, cache=cache)
for retry in range(MAX_RETRIES):
try:
path = download_file(URL + filename, cache=cache, timeout=30)
except:
if retry == MAX_RETRIES - 1:
raise
else:
time.sleep(TIME_BETWEEN_RETRIES)
else:
break
return fits.open(path)[0]


Expand Down

0 comments on commit f9c956a

Please sign in to comment.