16
16
from astroquery .exceptions import CorruptDataWarning
17
17
from astroquery .alma import Alma , get_enhanced_table
18
18
19
+ try :
20
+ import regions
21
+
22
+ HAS_REGIONS = True
23
+ except ImportError :
24
+ HAS_REGIONS = False
25
+
19
26
# ALMA tests involving staging take too long, leading to travis timeouts
20
27
# TODO: make this a configuration item
21
28
SKIP_SLOW = True
@@ -62,11 +69,10 @@ def test_public(self, alma):
62
69
for row in results :
63
70
assert row ['data_rights' ] == 'Proprietary'
64
71
72
+ @pytest .mark .skipif (not HAS_REGIONS , reason = "regions is required" )
65
73
@pytest .mark .filterwarnings (
66
74
"ignore::astropy.utils.exceptions.AstropyUserWarning" )
67
75
def test_s_region (self , alma ):
68
- pytest .importorskip ('regions' )
69
- import regions # to silence checkstyle
70
76
alma .help_tap ()
71
77
result = alma .query_tap ("select top 3 s_region from ivoa.obscore" )
72
78
enhanced_result = get_enhanced_table (result )
@@ -75,6 +81,7 @@ def test_s_region(self, alma):
75
81
regions .PolygonSkyRegion ,
76
82
regions .CompoundSkyRegion ))
77
83
84
+ @pytest .mark .skipif (not HAS_REGIONS , reason = "regions is required" )
78
85
@pytest .mark .filterwarnings (
79
86
"ignore::astropy.utils.exceptions.AstropyUserWarning" )
80
87
def test_SgrAstar (self , tmp_path , alma ):
0 commit comments