Skip to content

Commit

Permalink
TST: skipping test when dependency is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
bsipocz committed Jun 14, 2024
1 parent 2f2a643 commit c529bfd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions astroquery/alma/tests/test_alma_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
from astroquery.exceptions import CorruptDataWarning
from astroquery.alma import Alma, get_enhanced_table

try:
import regions

HAS_REGIONS = True
except ImportError:
HAS_REGIONS = False

# ALMA tests involving staging take too long, leading to travis timeouts
# TODO: make this a configuration item
SKIP_SLOW = True
Expand Down Expand Up @@ -62,11 +69,10 @@ def test_public(self, alma):
for row in results:
assert row['data_rights'] == 'Proprietary'

@pytest.mark.skipif(not HAS_REGIONS, reason="regions is required")
@pytest.mark.filterwarnings(
"ignore::astropy.utils.exceptions.AstropyUserWarning")
def test_s_region(self, alma):
pytest.importorskip('regions')
import regions # to silence checkstyle
alma.help_tap()
result = alma.query_tap("select top 3 s_region from ivoa.obscore")
enhanced_result = get_enhanced_table(result)
Expand All @@ -75,6 +81,7 @@ def test_s_region(self, alma):
regions.PolygonSkyRegion,
regions.CompoundSkyRegion))

@pytest.mark.skipif(not HAS_REGIONS, reason="regions is required")
@pytest.mark.filterwarnings(
"ignore::astropy.utils.exceptions.AstropyUserWarning")
def test_SgrAstar(self, tmp_path, alma):
Expand Down

0 comments on commit c529bfd

Please sign in to comment.