swh_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7fb9cb8c8da0>
requests_mock = <requests_mock.mocker.Mocker object at 0x7fb9cb8c87b8>
maven_pom_1_malformed = b'<?xml version="1.0" encoding="UTF-8"?>\n<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven....actId>\n <version>3.10.0</version>\n <scope>test</scope>\n </dependency>\n </dependencies>\n</project>\n'
def test_maven_full_listing_malformed(
swh_scheduler,
requests_mock,
maven_pom_1_malformed,
):
"""Covers full listing of multiple pages, checking page results with a malformed
scm entry in pom."""
lister = MavenLister(
scheduler=swh_scheduler,
url=MVN_URL,
instance="maven.org",
index_url=INDEX_URL,
incremental=False,
)
# Set up test.
requests_mock.get(URL_POM_1, content=maven_pom_1_malformed)
# Then run the lister.
> stats = lister.run()
.tox/py3/lib/python3.7/site-packages/swh/lister/maven/tests/test_lister.py:157:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.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 0x7fb9cb8c88d0>
request = <requests_mock.request._RequestObjectProxy object at 0x7fb9cbf33c88>
kwargs = {'cert': None, 'proxies': OrderedDict(), 'stream': False, 'timeout': None, ...}
matcher = <requests_mock.adapter._Matcher object at 0x7fb9cb8c89b0>, 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