Skip to content

Commit

Permalink
fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
teutoburg committed Oct 26, 2023
1 parent 13daf4e commit 2048146
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
7 changes: 4 additions & 3 deletions skycalc_ipy/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ class SkyModel(ESOQueryBase):

def __init__(self):
self.data = None
self.data_url = "/tmp"
self.data_url = "/tmp/"
self.deleter_script_url = "/api/rmtmp"
self._last_status = ""
self.tmpdir = ""
Expand Down Expand Up @@ -412,9 +412,10 @@ def _retrieve_data(self, url):
# Use a fixed date so the stored files are always identical for
# identical requests.
self.data[0].header["DATE"] = "2017-01-07T00:00:00"
except httpx.HTTPError:
except Exception as err:
logging.exception(
"Exception raised trying to get FITS data from %s", url)
raise err

def write(self, local_filename, **kwargs):
"""Write data to file."""
Expand Down Expand Up @@ -483,7 +484,7 @@ def __call__(self, **kwargs):
try:
# retrive and save FITS data (in memory)
self._retrieve_data(
self.base_url + self.data_url + tmpdir + "/skytable.fits")
self.BASE_URL + self.data_url + tmpdir + "/skytable.fits")
except httpx.HTTPError as err:
logging.exception("Could not retrieve FITS data from server.")
raise err
Expand Down
14 changes: 6 additions & 8 deletions skycalc_ipy/tests/test_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,17 @@ def test_print_comments_single_keywords(self, skp, capsys):
assert output == "airmass : airmass in range [1.0, 3.0]"

def test_print_comments_mutliple_keywords(self, skp, capsys):
skp.print_comments(["airmass", "season"])
skp.print_comments("airmass", "season")
output = capsys.readouterr()[0].strip()
assert (
output
== "airmass : airmass in range [1.0, 3.0]\n"
+ "season : 0=all year, 1=dec/jan,2=feb/mar..."
)
expected = ("airmass : airmass in range [1.0, 3.0]\n"
" season : 0=all year, 1=dec/jan,2=feb/mar...")
assert output == expected

def test_print_comments_misspelled_keyword(self, skp, capsys):
skp.print_comments(["iarmass"])
skp.print_comments("iarmass")
sys_out = capsys.readouterr()
output = sys_out[0].strip()
assert output == "iarmass not found"
assert output == "iarmass : <parameter not found>"

def test_keys_returns_list_of_keys(self, skp):
assert isinstance(skp.keys, Sequence)
Expand Down

0 comments on commit 2048146

Please sign in to comment.