datadir = '/var/lib/jenkins/workspace/DLS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/lister/sourceforge/tests/data'
swh_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7f03deb6c940>
requests_mock = <requests_mock.mocker.Mocker object at 0x7f03deb6c278>
status_code = 403
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f03deb6c320>
@pytest.mark.parametrize("status_code", [500, 503, 504, 403, 404])
def test_sourceforge_lister_project_error(
datadir, swh_scheduler, requests_mock, status_code, mocker
):
lister = SourceForgeLister(scheduler=swh_scheduler)
# Exponential retries take a long time, so stub time.sleep
mocker.patch.object(lister.page_request.retry, "sleep")
requests_mock.get(
MAIN_SITEMAP_URL,
text=get_main_sitemap(datadir),
additional_matcher=_check_request_headers,
)
requests_mock.get(
"https://sourceforge.net/allura_sitemap/sitemap-0.xml",
text=get_subsitemap_0(datadir),
additional_matcher=_check_request_headers,
)
requests_mock.get(
"https://sourceforge.net/allura_sitemap/sitemap-1.xml",
text=get_subsitemap_1(datadir),
additional_matcher=_check_request_headers,
)
# Request mocks precedence is LIFO
requests_mock.get(
re.compile("https://sourceforge.net/rest/.*"),
json=functools.partial(get_project_json, datadir),
additional_matcher=_check_request_headers,
)
# Make all `mramm` requests fail
# `mramm` is in subsitemap 0, which ensures we keep listing after an error.
requests_mock.get(
re.compile("https://sourceforge.net/rest/p/mramm"), status_code=status_code
)
> stats = lister.run()
.tox/py3/lib/python3.7/site-packages/swh/lister/sourceforge/tests/test_lister.py:400:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.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:47: in grouper
for _data in itertools.zip_longest(*args, fillvalue=stop_value):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.lister.sourceforge.lister.SourceForgeLister object at 0x7f03deb6c588>
page = [SourceForgeListerEntry(vcs=<VcsNames.GIT: 'git'>, url='https://git.code.sf.net/p/os3dmodels/git', last_modified='2017...terEntry(vcs=<VcsNames.SUBVERSION: 'svn'>, url='https://svn.code.sf.net/p/os3dmodels/svn', last_modified='2017-03-31')]
def get_origins_from_page(
self, page: SourceForgeListerPage
) -> Iterator[ListedOrigin]:
assert self.lister_obj.id is not None
for hit in page:
last_update = datetime.datetime.combine(
> hit.last_modified, datetime.time(tzinfo=datetime.timezone.utc)
)
E TypeError: combine() argument 1 must be datetime.date, not str
.tox/py3/lib/python3.7/site-packages/swh/lister/sourceforge/lister.py:251: TypeError
TEST RESULT
TEST RESULT
- Run At
- Nov 23 2021, 10:55 AM