Skip to content

Commit

Permalink
Merge pull request #121 from sot/greta-planet
Browse files Browse the repository at this point in the history
Use has_internet to skip planet tests requiring network
  • Loading branch information
jeanconn authored Mar 16, 2022
2 parents 9a5a948 + 3e8d417 commit 225f439
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions chandra_aca/tests/test_planets.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import astropy.units as u
import pytest

from testr.test_helper import has_internet
from cxotime import CxoTime
from chandra_aca.planets import (get_planet_chandra, get_planet_barycentric,
get_planet_chandra_horizons, get_planet_eci,
Expand All @@ -13,6 +14,10 @@
from agasc import sphere_dist


HAS_INTERNET = has_internet()


@pytest.mark.skipif(not HAS_INTERNET, reason='Requires network access')
def test_planet_positions():
# Test basic functionality and include regression values (not an independent
# functional test)
Expand Down Expand Up @@ -105,6 +110,7 @@ def test_planet_positions_array():
assert np.all(sphere_dist(ra, dec, ra2, dec2) * 3600 < 1.0)


@pytest.mark.skipif(not HAS_INTERNET, reason='Requires network access')
def test_get_chandra_planet_horizons():
dat = get_planet_chandra_horizons('jupiter', '2020:001', '2020:002', n_times=11)
exp = [' time ra dec rate_ra rate_dec mag '
Expand Down Expand Up @@ -139,6 +145,7 @@ def test_get_chandra_planet_horizons():
assert dat.pformat_all() == exp


@pytest.mark.skipif(not HAS_INTERNET, reason='Requires network access')
@pytest.mark.parametrize('obs_pos,exp_sep', [('chandra-horizons', 0.0),
('chandra', 0.74),
('earth', 23.02)])
Expand All @@ -150,6 +157,7 @@ def test_get_planet_ang_separation_scalar(obs_pos, exp_sep):
assert np.isclose(sep * 3600, exp_sep, atol=1e-2, rtol=0)


@pytest.mark.skipif(not HAS_INTERNET, reason='Requires network access')
@pytest.mark.parametrize('obs_pos,exp_sep', [('chandra-horizons', [0.0, 33.98]),
('chandra', [0.74, 33.25]),
('earth', [23.02, 47.07])])
Expand Down

0 comments on commit 225f439

Please sign in to comment.