swh_indexer_config = {'compute_checksums': ['blake2b512'], 'indexer_storage': {'cls': 'local', 'db': "user=postgres password=xxx dbname=ind...uler': {'cls': 'local', 'db': "user=postgres password=xxx dbname=scheduler host=127.0.0.1 port=26520 options=''"}, ...}
idx_storage = <swh.indexer.storage.IndexerStorage object at 0x7f60ca168a20>
storage = <swh.storage.postgresql.storage.Storage object at 0x7f60ca12a2e8>
obj_storage = <swh.objstorage.backends.in_memory.InMemoryObjStorage object at 0x7f60ca12a898>
def test_origin_metadata_indexer(
swh_indexer_config,
idx_storage: IndexerStorageInterface,
storage: StorageInterface,
obj_storage,
) -> None:
indexer = OriginMetadataIndexer(config=swh_indexer_config)
origin = "https://github.com/librariesio/yarn-parser"
indexer.run([origin])
tool = swh_indexer_config["tools"]
rev_id = REVISION.id
rev_metadata = RevisionIntrinsicMetadataRow(
id=rev_id,
tool=tool,
metadata=YARN_PARSER_METADATA,
mappings=["npm"],
)
origin_metadata = OriginIntrinsicMetadataRow(
id=origin,
tool=tool,
from_revision=rev_id,
metadata=YARN_PARSER_METADATA,
mappings=["npm"],
)
rev_results = list(idx_storage.revision_intrinsic_metadata_get([rev_id]))
for rev_result in rev_results:
assert rev_result.tool
del rev_result.tool["id"]
> assert rev_results == [rev_metadata]
E AssertionError: assert [] == [RevisionIntr...ings=['npm'])]
E Right contains one more item: RevisionIntrinsicMetadataRow(indexer_configuration_id=None, tool={'name': 'swh-metadata-translator', 'version': '0.0.2... 'yarn-parser', 'keywords': ['yarn', 'parse', 'lock', 'dependencies'], 'type': 'SoftwareSourceCode'}, mappings=['npm'])
E Full diff:
E - [RevisionIntrinsicMetadataRow(indexer_configuration_id=None, tool={'name': 'swh-metadata-translator', 'version': '0.0.2', 'configuration': {'type': 'local', 'context': 'NpmMapping'}}, id=b'\xc6 \x1c\xb1\xb9\xb9\xdf\x9auB\xf9f\\;]\xfa\xb8^\x97u', metadata={'@context': 'https://doi.org/10.5063/schema/codemeta-2.0', 'url': ...
E
E ...Full output truncated (2 lines hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/swh/indexer/tests/test_origin_metadata.py:63: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Apr 18 2022, 8:43 PM