Skip to content

Commit 0e87c73

Browse files
authored
Merge pull request #3579 from lpsinger/cache-timeout--1
Disable cache expiration if timeout is -1 instead of None
2 parents c7eb4b4 + 87d9fc3 commit 0e87c73

4 files changed

Lines changed: 8 additions & 7 deletions

File tree

CHANGES.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ esa.euclid
5454
- The method ``get_spectrum`` accepts the new parameter ``linking_parameter`` to retrieve the spectra by source_id and
5555
sourcepatch_id. [#3543]
5656
- The ``source_id`` kwarg in the ``get_spectrum`` method has been renamed to ``ids``. [#3543]
57-
- Method ``get_cutout`` has deprecated the 'instrument' and 'id' parameters, providing them has no effect any more.
57+
- Method ``get_cutout`` has deprecated the 'instrument' and 'id' parameters, providing them has no effect any more.
5858
The method now only supports retrieval of MER (background‑subtracted) image cutouts. [#3559]
59-
- The ``get_product_list`` method now also returns file_name_list column when the product type belongs to
59+
- The ``get_product_list`` method now also returns file_name_list column when the product type belongs to
6060
BASIC_DOWNLOAD_DATA_PRODUCTS. [#3562]
6161
- The method ``get_spectrum`` accepts a single source_id or designation or multiple values separated by commas or a
6262
list. [#3570]
@@ -74,7 +74,7 @@ mast
7474
now check all requested products against cloud storage. As a result, setting ``cloud_only=True`` will skip
7575
any products that are not available in the cloud, rather than falling back to on-prem downloads.
7676
- The ``objectname`` keyword is deprecated in ``MastMissions`` in favor of ``object_names``. [#3540]
77-
- The ``objectname`` parameter in ``Catalogs``, ``Observations``, ``Tesscut``, and ``utils`` is deprecated
77+
- The ``objectname`` parameter in ``Catalogs``, ``Observations``, ``Tesscut``, and ``utils`` is deprecated
7878
in favor of ``object_name``. [#3567]
7979

8080
vo_conesearch
@@ -199,6 +199,7 @@ Infrastructure, Utility and Other Changes and Additions
199199
- ``BaseVOQuery`` now accepts a ``extra_user_agents`` parameter to allow the addition
200200
of user agents on top of astroquery's ones [#3526]
201201

202+
- Fix no experation case for ``cache_timeout`` config option. [#3579]
202203

203204
utils.tap
204205
^^^^^^^^^

astroquery/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Cache_Conf(_config.ConfigNamespace):
4949
cache_timeout = _config.ConfigItem(
5050
604800,
5151
('Astroquery-wide cache timeout (seconds). Default is 1 week (604800). '
52-
'Setting to None prevents the cache from expiring (not recommended).'),
52+
'Setting to -1 prevents the cache from expiring (not recommended).'),
5353
cfgtype='integer'
5454
)
5555

astroquery/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def request_file(self, cache_location):
116116
def from_cache(self, cache_location, cache_timeout):
117117
request_file = self.request_file(cache_location)
118118
try:
119-
if cache_timeout is None:
119+
if cache_timeout == -1:
120120
expired = False
121121
else:
122122
current_time = datetime.now(timezone.utc)

astroquery/tests/test_cache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ def test_timeout(changing_mocked_response, monkeypatch):
167167
resp = mytest.test_func(URL1)
168168
assert resp.content == TEXT2 # now see the new response
169169

170-
# Testing a cache timeout of "none"
171-
cache_conf.cache_timeout = None
170+
# Testing a cache timeout of -1
171+
cache_conf.cache_timeout = -1
172172
# Ensure response can only come from cache.
173173
monkeypatch.delattr(requests.Session, "request")
174174

0 commit comments

Comments
 (0)