ValueError: <ObjectType.REVISION: 'rev'> is not a valid ExtendedObjectType
During handling of the above exception, another exception occurred:
swh_storage = <swh.storage.postgresql.storage.Storage object at 0x7f7885131b70>
datadir = '/var/lib/jenkins/workspace/DMFCD/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/clearlydefined/tests/data'
def test_map_row_for_definitions_with_gitsha1(swh_storage, datadir):
add_revision_data(swh_storage)
expected = (
MappingStatus.MAPPED,
[
RawExtrinsicMetadata(
target=ExtendedSWHID.from_string(
"swh:1:rev:4c66129b968ab8122964823d1d77677f50884cf6"
),
discovery_date=datetime(year=2021, month=2, day=6, tzinfo=timezone.utc),
authority=AUTHORITY,
fetcher=FETCHER,
format="clearlydefined-definition-json",
origin="http://central.maven.org/maven2/za/co/absa/cobrix/cobol-parser/"
"0.4.0/cobol-parser-0.4.0-sources.jar",
metadata=json.dumps(
json.loads(
file_data(os.path.join(datadir, "definitions_sha1git.json"))
)
).encode("utf-8"),
),
],
)
> assert (
map_row(
storage=swh_storage,
id="maven/mavencentral/za.co.absa.cobrix/cobol-parser/revision/0.4.0.json",
metadata=gzip.compress(
file_data(os.path.join(datadir, "definitions_sha1git.json")).encode()
),
date=datetime(year=2021, month=2, day=6, tzinfo=timezone.utc),
)
== expected
)
.tox/py3/lib/python3.7/site-packages/swh/clearlydefined/tests/test_mapping_utils.py:217:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/clearlydefined/mapping_utils.py:338: in map_row
metadata_string=metadata_string, storage=storage, date=date
.tox/py3/lib/python3.7/site-packages/swh/clearlydefined/mapping_utils.py:261: in map_definition
object_type=ObjectType.REVISION, object_id=hash_to_bytes(sha1_git)
<attrs generated init swh.model.identifiers.ExtendedSWHID>:7: in __init__
_inst_dict['object_type'] = __attr_converter_object_type(object_type)
/usr/lib/python3.7/enum.py:310: in __call__
return cls.__new__(cls, value)
/usr/lib/python3.7/enum.py:564: in __new__
raise exc
/usr/lib/python3.7/enum.py:548: in __new__
result = cls._missing_(value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <enum 'ExtendedObjectType'>, value = <ObjectType.REVISION: 'rev'>
@classmethod
def _missing_(cls, value):
> raise ValueError("%r is not a valid %s" % (value, cls.__name__))
E ValueError: <ObjectType.REVISION: 'rev'> is not a valid ExtendedObjectType
/usr/lib/python3.7/enum.py:577: ValueError
TEST RESULT
TEST RESULT
- Run At
- Mar 5 2021, 9:35 AM