Skip to content

Commit 20e7460

Browse files
committed
Fixed tests
1 parent bbc15da commit 20e7460

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

astroquery/astrometry_net/tests/test_astrometry_net.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,15 @@ def data_path(filename):
1313
return os.path.join(DATA_DIR, filename)
1414

1515

16-
def test_api_key_property(caplog):
16+
def test_api_key_property():
1717
"""
1818
Check that an empty key is returned if the api key is not in
1919
the configuration file and that the expected message shows up in
2020
the log.
2121
"""
22-
caplog.clear()
2322
anet = AstrometryNet()
24-
key = anet.api_key
25-
assert not key
26-
assert "Astrometry.net API key not in configuration file" in caplog.text
23+
with pytest.raises(RuntimeError, match='Astrometry.net API key not set'):
24+
anet.api_key
2725

2826

2927
def test_empty_settings_property():
@@ -56,9 +54,8 @@ def test_login_fails_with_no_api_key():
5654
"""
5755
anet = AstrometryNet()
5856
anet.api_key = ''
59-
with pytest.raises(RuntimeError) as e:
57+
with pytest.raises(RuntimeError, match='Astrometry.net API key not set'):
6058
anet._login()
61-
assert "You must set the API key before using this service." in str(e.value)
6259

6360

6461
def test_construct_payload():

0 commit comments

Comments
 (0)