Pytest suite fails because w3.org file cannot be found
duncanmmacleod opened this issue · 1 comments
duncanmmacleod commented
I'm seeing a 404 error running the pytest suite for hveto:
$ python -m pytest hveto/tests/test_segments.py -k test_read_veto_definer_file
rootdir: /home/duncan/git/hveto, configfile: setup.cfg
plugins: sugar-0.9.4, forked-1.4.0, requests-mock-1.9.3, mock-3.8.2, rerunfailures-10.2, socket-0.5.1, cov-3.0.0, requires-0.1.0, xdist-2.5.0, ligo.skymap-1.0.2, order-1.0.1
collecting ...
―――――――――――――――――――――――――――――――――――― test_read_veto_definer_file ―――――――――――――――――――――――――――――――――――――
dqflag = <MagicMock name='from_veto_definer_file' id='139786852857792'>
tmpdir = local('/tmp/pytest-of-duncan/pytest-1374/test_read_veto_definer_file0')
@mock.patch('gwpy.segments.DataQualityDict.from_veto_definer_file')
def test_read_veto_definer_file(dqflag, tmpdir):
dqflag.return_value = TEST_DICT
os.chdir(str(tmpdir))
testfile = 'https://www.w3.org/TR/PNG/iso_8859-1.txt'
> dqdict = segments.read_veto_definer_file(testfile)
/home/duncan/git/hveto/hveto/tests/test_segments.py:80:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/duncan/git/hveto/hveto/segments.py:76: in read_veto_definer_file
tmp = urlopen(vetofile)
/home/duncan/opt/mambaforge/envs/py310/lib/python3.10/urllib/request.py:216: in urlopen
return opener.open(url, data, timeout)
/home/duncan/opt/mambaforge/envs/py310/lib/python3.10/urllib/request.py:525: in open
response = meth(req, response)
/home/duncan/opt/mambaforge/envs/py310/lib/python3.10/urllib/request.py:634: in http_response
response = self.parent.error(
/home/duncan/opt/mambaforge/envs/py310/lib/python3.10/urllib/request.py:557: in error
result = self._call_chain(*args)
/home/duncan/opt/mambaforge/envs/py310/lib/python3.10/urllib/request.py:496: in _call_chain
result = func(*args)
/home/duncan/opt/mambaforge/envs/py310/lib/python3.10/urllib/request.py:749: in http_error_302
return self.parent.open(new, timeout=req.timeout)
/home/duncan/opt/mambaforge/envs/py310/lib/python3.10/urllib/request.py:525: in open
response = meth(req, response)
/home/duncan/opt/mambaforge/envs/py310/lib/python3.10/urllib/request.py:634: in http_response
response = self.parent.error(
/home/duncan/opt/mambaforge/envs/py310/lib/python3.10/urllib/request.py:563: in error
return self._call_chain(*args)
/home/duncan/opt/mambaforge/envs/py310/lib/python3.10/urllib/request.py:496: in _call_chain
result = func(*args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <urllib.request.HTTPDefaultErrorHandler object at 0x7f22a9b55840>
req = <urllib.request.Request object at 0x7f22a9b55480>
fp = <http.client.HTTPResponse object at 0x7f22a9b552d0>, code = 404, msg = 'Not Found'
hdrs = <http.client.HTTPMessage object at 0x7f22a9b551e0>
def http_error_default(self, req, fp, code, msg, hdrs):
> raise HTTPError(req.full_url, code, msg, hdrs, fp)
E urllib.error.HTTPError: HTTP Error 404: Not Found
/home/duncan/opt/mambaforge/envs/py310/lib/python3.10/urllib/request.py:643: HTTPError
hveto/tests/test_segments.py ⨯ 100% ██████████
========================================== warnings summary ==========================================
../../opt/mambaforge/envs/py310/lib/python3.10/site-packages/setuptools/_distutils/version.py:346
/home/duncan/opt/mambaforge/envs/py310/lib/python3.10/site-packages/setuptools/_distutils/version.py:346: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
other = LooseVersion(other)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
Results (2.23s):
1 failed
- hveto/tests/test_segments.py:75 test_read_veto_definer_file
4 deselected
areeda commented
I don't understand what this w3.org file has to do with veto definer files.
Closing it as won't fix