Skip to content

Commit

Permalink
Attempt to work around the HOME hack
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadair committed May 22, 2019
1 parent 1e26d98 commit ec03261
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
22 changes: 14 additions & 8 deletions 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 *

Expand Down Expand Up @@ -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)
Expand All @@ -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)
1 change: 0 additions & 1 deletion tox.ini
Expand Up @@ -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 =
Expand Down

0 comments on commit ec03261

Please sign in to comment.