swh_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7fd0478d2400>
requests_mock = <requests_mock.mocker.Mocker object at 0x7fd0478d26d8>
maven_pom_1 = 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_list_pom_bad_encoding(swh_scheduler, requests_mock, maven_pom_1):
"""should continue listing when failing to decode pom file."""
# Test failure of pom parsing by reencoding a UTF-8 pom file to a not expected one
requests_mock.get(URL_POM_1, content=maven_pom_1.decode("utf-8").encode("utf-32"))
lister = MavenLister(scheduler=swh_scheduler, url=MVN_URL, index_url=INDEX_URL)
lister.run()
# If the maven_index_full step succeeded but not the pom parsing step,
# then we get only one maven-jar origin and one git origin.
scheduler_origins = swh_scheduler.get_listed_origins(lister.lister_obj.id).results
> assert len(scheduler_origins) == 3
E AssertionError: assert 2 == 3
E + where 2 = len([ListedOrigin(lister_id=UUID('d46ed73b-5b5b-420b-b9f7-fa2a608cfbe3'), url='https://github.com/ArangoDB-Community/arangodb-graphql-java', visit_type='git', extra_loader_arguments={}, last_update=None, enabled=True, first_seen=datetime.datetime(2022, 5, 23, 9, 57, 35, 487737, tzinfo=datetime.timezone.utc), last_seen=datetime.datetime(2022, 5, 23, 9, 57, 35, 487737, tzinfo=datetime.timezone.utc)), ListedOrigin(lister_id=UUID('d46ed73b-5b5b-420b-b9f7-fa2a608cfbe3'), url='https://repo1.maven.org/maven2/al/aldi/sprova4j', visit_type='maven', extra_loader_arguments={'artifacts': [{'aid': 'sprova4j', 'gid': 'al.aldi', 'url': 'https://repo1.maven.org/maven2/al/aldi/sprova4j/0.1.0/sprova4j-0.1.0-sources.jar', 'time': '2021-07-12T17:06:59+00:00', 'type': 'maven', 'version': '0.1.0', 'base_url': 'https://repo1.maven.org/maven2/'}, {'aid': 'sprova4j', 'gid': 'al.aldi', 'url': 'https://repo1.maven.org/maven2/al/aldi/sprova4j/0.1.1/sprova4j-0.1.1-sources.jar', 'time': '2021-07-12T17:37:05+00:00', 'type': 'maven', 'version': '0.1.1', 'base_url': 'https://repo1.maven.org/maven2/'}]}, last_update=datetime.datetime(2021, 7, 12, 17, 37, 5, tzinfo=datetime.timezone.utc), enabled=True, first_seen=datetime.datetime(2022, 5, 23, 9, 57, 35, 476360, tzinfo=datetime.timezone.utc), last_seen=datetime.datetime(2022, 5, 23, 9, 57, 35, 479603, tzinfo=datetime.timezone.utc))])
.tox/py3/lib/python3.7/site-packages/swh/lister/maven/tests/test_lister.py:353: AssertionError
TEST RESULT
TEST RESULT
- Run At
- May 23 2022, 11:58 AM