Repository navigation
Closed
astropy/astroquery
#1711Closed
Copy link
Labels
🔥CriticalCriticalAffects-devPRs and issues that do not impact an existing Astropy releasePRs and issues that do not impact an existing Astropy releaseBugDownstream Fix Requiredutilsutils.iers
Milestone
Description
The recent PR #9964 breaks astroquery. We see these two test failures (run python setup.py test -P utils -R to reproduce):
I suppose we might be be able to patch it around, but as it's to be released in LTS, too I rather see it as an affect-dev bug:
======================================================= FAILURES =======================================================
_______________________________________________ test_filecontainer_save ________________________________________________
patch_getreadablefileobj = None
def test_filecontainer_save(patch_getreadablefileobj):
ffile = commons.FileContainer(fitsfilepath, encoding='binary')
temp_dir = tempfile.mkdtemp()
empty_temp_file = temp_dir + os.sep + 'test_emptyfile.fits'
> ffile.save_fits(empty_temp_file)
astroquery/utils/tests/test_utils.py:463:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
astroquery/utils/commons.py:390: in save_fits
self.get_fits()
astroquery/utils/commons.py:365: in get_fits
filedata = self.get_string()
astroquery/utils/commons.py:424: in get_string
with self._readable_object as f:
/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py:112: in __enter__
return next(self.gen)
/usr/local/lib/python3.7/site-packages/astropy/utils/data.py:237: in get_readable_fileobj
http_headers=http_headers)
/usr/local/lib/python3.7/site-packages/astropy/utils/data.py:1172: in download_file
ftp_tls=ftp_tls)
/usr/local/lib/python3.7/site-packages/astropy/utils/data.py:999: in _download_file_from_source
with urlopener.open(req, timeout=timeout) as remote:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <urllib.request.OpenerDirector object at 0x135ca8ad0>
fullurl = '/private/var/folders/dc/hsm7tqpx2d57n7vb3k1l81xw0000gq/T/astroquery-test-1ysei6gt/lib/python3.7/site-packages/astroquery/utils/tests/../../sdss/tests/data/emptyfile.fits'
data = None, timeout = 10.0
def open(self, fullurl, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
# accept a URL or a Request object
if isinstance(fullurl, str):
req = Request(fullurl, data)
else:
req = fullurl
if data is not None:
req.data = data
> req.timeout = timeout
E AttributeError: 'str' object has no attribute 'timeout'
/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py:516: AttributeError
------------------------------------------------- Captured stdout call -------------------------------------------------
Monkeyed URLrequest
Monkeyed URLrequest
________________________________________________ test_filecontainer_get ________________________________________________
patch_getreadablefileobj = None
def test_filecontainer_get(patch_getreadablefileobj):
ffile = commons.FileContainer(fitsfilepath, encoding='binary')
> ff = ffile.get_fits()
astroquery/utils/tests/test_utils.py:469:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
astroquery/utils/commons.py:365: in get_fits
filedata = self.get_string()
astroquery/utils/commons.py:424: in get_string
with self._readable_object as f:
/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py:112: in __enter__
return next(self.gen)
/usr/local/lib/python3.7/site-packages/astropy/utils/data.py:237: in get_readable_fileobj
http_headers=http_headers)
/usr/local/lib/python3.7/site-packages/astropy/utils/data.py:1172: in download_file
ftp_tls=ftp_tls)
/usr/local/lib/python3.7/site-packages/astropy/utils/data.py:999: in _download_file_from_source
with urlopener.open(req, timeout=timeout) as remote:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <urllib.request.OpenerDirector object at 0x135e4afd0>
fullurl = '/private/var/folders/dc/hsm7tqpx2d57n7vb3k1l81xw0000gq/T/astroquery-test-1ysei6gt/lib/python3.7/site-packages/astroquery/utils/tests/../../sdss/tests/data/emptyfile.fits'
data = None, timeout = 10.0
def open(self, fullurl, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
# accept a URL or a Request object
if isinstance(fullurl, str):
req = Request(fullurl, data)
else:
req = fullurl
if data is not None:
req.data = data
> req.timeout = timeout
E AttributeError: 'str' object has no attribute 'timeout'
/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py:516: AttributeError
------------------------------------------------- Captured stdout call -------------------------------------------------
Monkeyed URLrequest
Monkeyed URLrequest
============================================= 2 failed, 54 passed in 8.24s =============================================
Metadata
Metadata
Assignees
Labels
🔥CriticalCriticalAffects-devPRs and issues that do not impact an existing Astropy releasePRs and issues that do not impact an existing Astropy releaseBugDownstream Fix Requiredutilsutils.iers
Activity
pllim commentedon Apr 29, 2020
I think this needs to be fixed on the
astroqueryside:https://github.com/astropy/astroquery/blob/5076ec55f2b989df53d965729c91a621dd5bb943/astroquery/utils/tests/test_utils.py#L409
pllim commentedon Apr 29, 2020
To clarify: On the
astroquerymonkeypatch, all the patching ofurllib.request.urlopenneeds to be modified accordingly.