swh_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7fb9cbcc5a58>
requests_mock = <requests_mock.mocker.Mocker object at 0x7fb9cbcc5780>
http_code = 404
@pytest.mark.parametrize("http_code", [400, 404, 500, 502])
def test_maven_list_http_error_artifacts(
swh_scheduler,
requests_mock,
http_code,
):
"""should continue listing when failing to retrieve artifacts."""
# Test failure of artefacts retrieval.
requests_mock.get(URL_POM_1, status_code=http_code)
lister = MavenLister(scheduler=swh_scheduler, url=MVN_URL, index_url=INDEX_URL)
# on artifacts though, that raises but continue listing
> lister.run()
.tox/py3/lib/python3.7/site-packages/swh/lister/maven/tests/test_lister.py:292:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/lister/pattern.py:130: in run
full_stats.origins += self.send_origins(origins)
.tox/py3/lib/python3.7/site-packages/swh/lister/pattern.py:233: in send_origins
for batch_origins in grouper(origins, n=1000):
.tox/py3/lib/python3.7/site-packages/swh/core/utils.py:53: in grouper
for _data in itertools.zip_longest(*args, fillvalue=stop_value):
.tox/py3/lib/python3.7/site-packages/swh/lister/maven/lister.py:326: in get_origins_from_page
listed_origin = self.get_scm(page)
.tox/py3/lib/python3.7/site-packages/swh/lister/maven/lister.py:311: in get_scm
url = self.github_session.get_canonical_url(url)
.tox/py3/lib/python3.7/site-packages/swh/core/github/utils.py:226: in get_canonical_url
response = self.request(_url_github_api(user_repo))
.tox/py3/lib/python3.7/site-packages/swh/core/github/utils.py:176: in request
return self._request(url)
.tox/py3/lib/python3.7/site-packages/tenacity/__init__.py:324: in wrapped_f
return self(f, *args, **kw)
.tox/py3/lib/python3.7/site-packages/tenacity/__init__.py:404: in __call__
do = self.iter(retry_state=retry_state)
.tox/py3/lib/python3.7/site-packages/tenacity/__init__.py:349: in iter
return fut.result()
/usr/lib/python3.7/concurrent/futures/_base.py:425: in result
return self.__get_result()
/usr/lib/python3.7/concurrent/futures/_base.py:384: in __get_result
raise self._exception
.tox/py3/lib/python3.7/site-packages/tenacity/__init__.py:407: in __call__
result = fn(*args, **kwargs)
.tox/py3/lib/python3.7/site-packages/swh/core/github/utils.py:148: in _request
response = self.session.get(url)
.tox/py3/lib/python3.7/site-packages/requests/sessions.py:542: in get
return self.request('GET', url, **kwargs)
.tox/py3/lib/python3.7/site-packages/requests/sessions.py:529: in request
resp = self.send(prep, **send_kwargs)
.tox/py3/lib/python3.7/site-packages/requests_mock/mocker.py:144: in _fake_send
return _original_send(session, request, **kwargs)
.tox/py3/lib/python3.7/site-packages/requests/sessions.py:645: in send
r = adapter.send(request, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <requests_mock.adapter.Adapter object at 0x7fb9cbcc5898>
request = <requests_mock.request._RequestObjectProxy object at 0x7fb9cb8d7940>
kwargs = {'cert': None, 'proxies': OrderedDict(), 'stream': False, 'timeout': None, ...}
matcher = <requests_mock.adapter._Matcher object at 0x7fb9cbcc5b70>, resp = None
def send(self, request, **kwargs):
request = _RequestObjectProxy(request,
case_sensitive=self._case_sensitive,
**kwargs)
self._add_to_history(request)
for matcher in reversed(self._matchers):
try:
resp = matcher(request)
except Exception:
request._matcher = weakref.ref(matcher)
raise
if resp is not None:
request._matcher = weakref.ref(matcher)
resp.connection = self
logger.debug('{} {} {}'.format(request._request.method,
request._request.url,
resp.status_code))
return resp
> raise exceptions.NoMockAddress(request)
E requests_mock.exceptions.NoMockAddress: No mock address: GET https://api.github.com/repos/aldialimucaj/sprova4j
.tox/py3/lib/python3.7/site-packages/requests_mock/adapter.py:261: NoMockAddress
TEST RESULT
TEST RESULT
- Run At
- May 20 2022, 4:42 PM