diff --git a/sunpy/coordinates/tests/test_ephemeris.py b/sunpy/coordinates/tests/test_ephemeris.py index f0cc1dcfbf0..ae2a457177c 100644 --- a/sunpy/coordinates/tests/test_ephemeris.py +++ b/sunpy/coordinates/tests/test_ephemeris.py @@ -1,11 +1,13 @@ # -*- coding: utf-8 -*- +import pytest + import astropy.units as u +from astropy.config.paths import set_temp_cache +from astropy.constants import c as speed_of_light +from astropy.coordinates import EarthLocation, SkyCoord from astropy.tests.helper import assert_quantity_allclose -from astropy.coordinates import SkyCoord, EarthLocation from astropy.time import Time -from astropy.constants import c as speed_of_light -import pytest from sunpy.coordinates.ephemeris import * @@ -114,18 +116,21 @@ def test_get_sun_orientation(): assert_quantity_allclose(angle, -110.8*u.deg, atol=0.1*u.deg) + @pytest.mark.remote_data -def test_get_horizons_coord(): +def test_get_horizons_coord(tmpdir): # get_horizons_coord() depends on astroquery astroquery = pytest.importorskip("astroquery") - # Validate against published values from the Astronomical Almanac (2013) - e1 = get_horizons_coord('Geocenter', '2013-Jan-01') + with set_temp_cache(tmpdir): + # Validate against published values from the Astronomical Almanac (2013) + e1 = get_horizons_coord('Geocenter', '2013-Jan-01') assert_quantity_allclose((e1.lon + 1*u.deg) % (360*u.deg), 1*u.deg, atol=5e-6*u.deg) assert_quantity_allclose(e1.lat, -3.03*u.deg, atol=5e-3*u.deg) assert_quantity_allclose(e1.radius, 0.9832947*u.AU, atol=5e-7*u.AU) - e2 = get_horizons_coord('Geocenter', '2013-Sep-01') + with set_temp_cache(tmpdir): + e2 = get_horizons_coord('Geocenter', '2013-Sep-01') assert_quantity_allclose((e2.lon + 1*u.deg) % (360*u.deg), 1*u.deg, atol=5e-6*u.deg) assert_quantity_allclose(e2.lat, 7.19*u.deg, atol=5e-3*u.deg) assert_quantity_allclose(e2.radius, 1.0092561*u.AU, atol=5e-7*u.AU) @@ -138,5 +143,6 @@ def test_consistency_with_horizons(): # Check whether the location of Earth is the same between Astropy and JPL HORIZONS e1 = get_earth() - e2 = get_horizons_coord('Geocenter') + with set_temp_cache(tmpdir): + e2 = get_horizons_coord('Geocenter') assert_quantity_allclose(e1.separation_3d(e2), 0*u.km, atol=25*u.km) diff --git a/tox.ini b/tox.ini index 966ee6d9edb..e0faecacfa3 100644 --- a/tox.ini +++ b/tox.ini @@ -7,7 +7,6 @@ changedir = tmp setenv = MPLBACKEND = agg COLUMNS = 180 - HOME = {homedir} PYTEST_COMMAND = pytest --pyargs sunpy --cov=sunpy --cov-config={toxinidir}/setup.cfg --verbose -m "not figure" --durations=25 extras = all,tests deps =