From c7f5c187971c89b9b6cf0aa1cd866b8016990f0b Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Wed, 27 Feb 2019 17:28:13 -0700 Subject: [PATCH] remove some comments, still not done with the PR --- astroquery/higal/core.py | 5 +---- astroquery/higal/tests/test_higal.py | 23 ++++------------------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/astroquery/higal/core.py b/astroquery/higal/core.py index 4c1ac334cf..3ce96b02ee 100644 --- a/astroquery/higal/core.py +++ b/astroquery/higal/core.py @@ -100,10 +100,6 @@ def query_region_async(self, coordinates, radius, return response - # as we mentioned earlier use various python regular expressions, etc - # to create the dict of HTTP request parameters by parsing the user - # entered values. For cleaner code keep this as a separate private method: - def _args_to_payload(self, coords=None, name=None, radius=10*u.arcmin, catalog_id=None, catalog_query=True, *args, **kwargs): @@ -111,6 +107,7 @@ def _args_to_payload(self, coords=None, name=None, radius=10*u.arcmin, # set up session: get cookies initial_response = self._request('GET', self.URL, cache=False, timeout=self.TIMEOUT) + initial_response.raise_for_status() # multiple cookies are returned self._session_id = self._session.cookies.values()[1] diff --git a/astroquery/higal/tests/test_higal.py b/astroquery/higal/tests/test_higal.py index 9af0fd283b..fabfcc61c3 100644 --- a/astroquery/higal/tests/test_higal.py +++ b/astroquery/higal/tests/test_higal.py @@ -1,18 +1,8 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import print_function -# astroquery uses the pytest framework for testing -# this is already available in astropy and does -# not require a separate install. Import it using: import pytest -# It would be best if tests are separated in two -# modules. This module performs tests on local data -# by mocking HTTP requests and responses. To test the -# same functions on the remote server, put the relevant -# tests in the 'test_module_remote.py' - -# Now import other commonly used modules for tests import os import requests @@ -23,10 +13,8 @@ from ...utils.testing_tools import MockResponse -# finally import the module which is to be tested -# and the various configuration items created -from ... import template_module -from ...template_module import conf +from ... import higal +from ...higal import conf # Local tests should have the corresponding data stored # in the ./data folder. This is the actual HTTP response @@ -71,15 +59,12 @@ def patch_request(request): mp = request.getfixturevalue("monkeypatch") except AttributeError: # pytest < 3 mp = request.getfuncargvalue("monkeypatch") - mp.setattr(template_module.core.TemplateClass, '_request', + mp.setattr(higal.core.HiGalClass, '_request', nonremote_request) return mp # finally test the methods using the mock HTTP response def test_query_object(patch_request): - result = template_module.core.TemplateClass().query_object('m1') + result = higal.core.HiGalClass().query_object('m1') assert isinstance(result, Table) - -# similarly fill in tests for each of the methods -# look at tests in existing modules for more examples