Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.loader.package.maven.tests.test_maven::test_metadatata
Failed

TEST RESULT

Run At
Nov 29 2021, 3:43 PM
Details
swh_storage = <swh.storage.proxies.retry.RetryingProxyStorage object at 0x7ff2b0ba6dd8> requests_mock = <requests_mock.mocker.Mocker object at 0x7ff2b01a6048> data_jar_1 = b'PK\x03\x04\n\x00\x00\x08\x08\x00\xba\\\xb7L\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\t\x00\x00\x00META-INF/\x...*\x00\x00al/aldi/sprova4j/models/Execution.javaPK\x05\x06\x00\x00\x00\x00#\x00#\x00\xe2\n\x00\x00\xf4,\x00\x00\x00\x00' data_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_metadatata(swh_storage, requests_mock, data_jar_1, data_pom_1): """With no prior visit, loading a jar ends up with 1 snapshot. Extrinsic metadata is the pom file associated to the source jar. """ requests_mock.get(MVN_ARTIFACTS[0]["url"], content=data_jar_1) requests_mock.get(MVN_ARTIFACTS_POM[0], content=data_pom_1) loader = MavenLoader( swh_storage, MVN_ARTIFACTS[0]["url"], artifacts=[MVN_ARTIFACTS[0]] ) actual_load_status = loader.load() assert actual_load_status["status"] == "eventful" expected_release_id = hash_to_bytes(_expected_new_release_first_visit) release = swh_storage.release_get([expected_release_id])[0] assert release is not None release_swhid = CoreSWHID( object_type=ObjectType.RELEASE, object_id=expected_release_id ) directory_swhid = ExtendedSWHID( object_type=ExtendedObjectType.DIRECTORY, object_id=release.target ) metadata_authority = MetadataAuthority( type=MetadataAuthorityType.FORGE, url="https://repo1.maven.org/", ) json_metadata = { "time": "2021-07-12 19:06:59.335000", "url": ( "https://repo1.maven.org/maven2/al/aldi/sprova4j/0.1.0/" "sprova4j-0.1.0.jar" ), "gid": "al.aldi", "aid": "sprova4j", "filename": "sprova4j-0.1.0.jar", "version": "0.1.0", } metadata = [ RawExtrinsicMetadataCore( format="maven-pom", metadata=_expected_pom_metadata.encode(), ), RawExtrinsicMetadataCore( format="maven-json", metadata=json.dumps(json_metadata).encode(), ), ] expected_metadata = [ RawExtrinsicMetadata( target=directory_swhid, authority=metadata_authority, fetcher=MetadataFetcher( name="swh.loader.package.maven.loader.MavenLoader", version=__version__, ), discovery_date=loader.visit_date, format="maven-pom", metadata=metadata, origin=MVN_ARTIFACTS[0]["url"], > release=release_swhid, ) ] .tox/py3/lib/python3.7/site-packages/swh/loader/package/maven/tests/test_maven.py:473: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ <attrs generated init swh.model.model.RawExtrinsicMetadata>:22: in __init__ __attr_validator_metadata(self, __attr_metadata, self.metadata) .tox/py3/lib/python3.7/site-packages/attrs_strict/_type_validation.py:105: in _validator _validate_elements(attribute, field, attribute.type) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attribute = Attribute(name='metadata', default=NOTHING, validator=<function type_validator.<locals>._validator at 0x7ff2b6471378>,...True, metadata=mappingproxy({}), type=<class 'bytes'>, converter=None, kw_only=False, inherited=False, on_setattr=None) value = [RawExtrinsicMetadataCore(format='maven-pom', metadata=b'<?xml version="1.0" encoding="UTF-8"?>\n<project xsi:schemaLo...ar", "gid": "al.aldi", "aid": "sprova4j", "filename": "sprova4j-0.1.0.jar", "version": "0.1.0"}', discovery_date=None)] expected_type = <class 'bytes'> def _validate_elements(attribute, value, expected_type): if expected_type is None: return base_type = _get_base_type(expected_type) if base_type == typing.Any: return if isinstance(base_type, (str, ForwardRef)): # These base_types happen when you have string annotations and cannot # be used in isinstance. raise _StringAnnotationError() elif base_type == Literal or base_type == type(Literal): # type: ignore _handle_literal(attribute, value, expected_type) elif base_type == typing.Union: # type: ignore _handle_union(attribute, value, expected_type) elif not isinstance(value, base_type): > raise AttributeTypeError(value, attribute) E attrs_strict._error.AttributeTypeError: metadata must be <class 'bytes'> (got [RawExtrinsicMetadataCore(format='maven-pom', metadata=b'<?xml version="1.0" encoding="UTF-8"?>\n<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\n <modelVersion>4.0.0</modelVersion>\n <groupId>al.aldi</groupId>\n <artifactId>sprova4j</artifactId>\n <version>0.1.0</version>\n <name>sprova4j</name>\n <description>Java client for Sprova Test Management</description>\n <url>https://github.com/aldialimucaj/sprova4j</url>\n <inceptionYear>2018</inceptionYear>\n <licenses>\n <license>\n <name>The Apache Software License, Version 2.0</name>\n <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>\n <distribution>repo</distribution>\n </license>\n </licenses>\n <developers>\n <developer>\n <id>aldi</id>\n <name>Aldi Alimucaj</name>\n <email>aldi.alimucaj@gmail.com</email>\n </developer>\n </developers>\n <scm>\n <connection>scm:git:git://github.com/aldialimucaj/sprova4j.git</connection>\n <developerConnection>scm:git:git://github.com/aldialimucaj/sprova4j.git</developerConnection>\n <url>https://github.com/aldialimucaj/sprova4j</url>\n </scm>\n <dependencies>\n <dependency>\n <groupId>ch.qos.logback</groupId>\n <artifactId>logback-classic</artifactId>\n <version>1.2.3</version>\n <scope>runtime</scope>\n </dependency>\n <dependency>\n <groupId>com.google.code.gson</groupId>\n <artifactId>gson</artifactId>\n <version>2.8.3</version>\n <scope>runtime</scope>\n </dependency>\n <dependency>\n <groupId>com.squareup.okhttp3</groupId>\n <artifactId>okhttp</artifactId>\n <version>3.10.0</version>\n <scope>runtime</scope>\n </dependency>\n <dependency>\n <groupId>com.squareup.okio</groupId>\n <artifactId>okio</artifactId>\n <version>1.0.0</version>\n <scope>runtime</scope>\n </dependency>\n <dependency>\n <groupId>org.glassfish</groupId>\n <artifactId>javax.json</artifactId>\n <version>1.1.2</version>\n <scope>runtime</scope>\n </dependency>\n <dependency>\n <groupId>javax.json</groupId>\n <artifactId>javax.json-api</artifactId>\n <version>1.1.2</version>\n <scope>runtime</scope>\n </dependency>\n <dependency>\n <groupId>javax.validation</groupId>\n <artifactId>validation-api</artifactId>\n <version>2.0.1.Final</version>\n <scope>runtime</scope>\n </dependency>\n <dependency>\n <groupId>junit</groupId>\n <artifactId>junit</artifactId>\n <version>4.12</version>\n <scope>test</scope>\n </dependency>\n <dependency>\n <groupId>com.squareup.okhttp3</groupId>\n <artifactId>mockwebserver</artifactId>\n <version>3.10.0</version>\n <scope>test</scope>\n </dependency>\n </dependencies>\n</project>\n', discovery_date=None), RawExtrinsicMetadataCore(format='maven-json', metadata=b'{"time": "2021-07-12 19:06:59.335000", "url": "https://repo1.maven.org/maven2/al/aldi/sprova4j/0.1.0/sprova4j-0.1.0.jar", "gid": "al.aldi", "aid": "sprova4j", "filename": "sprova4j-0.1.0.jar", "version": "0.1.0"}', discovery_date=None)] that is a <class 'list'>) .tox/py3/lib/python3.7/site-packages/attrs_strict/_type_validation.py:131: AttributeTypeError