self = <swh.indexer.tests.test_metadata.Metadata testMethod=test_revision_metadata_indexer_single_root_dir>
def test_revision_metadata_indexer_single_root_dir(self):
metadata_indexer = RevisionMetadataIndexer(config=REVISION_METADATA_CONFIG)
fill_obj_storage(metadata_indexer.objstorage)
fill_storage(metadata_indexer.storage)
# Add a parent directory, that is the only directory at the root
# of the revision
rev = REVISION
assert rev.directory == DIRECTORY2.id
directory = Directory(
entries=(
DirectoryEntry(
name=b"foobar-1.0.0",
type="dir",
target=rev.directory,
perms=16384,
),
),
)
assert directory.id is not None
metadata_indexer.storage.directory_add([directory])
new_rev_dict = {**rev.to_dict(), "directory": directory.id}
new_rev_dict.pop("id")
new_rev = Revision.from_dict(new_rev_dict)
metadata_indexer.storage.revision_add([new_rev])
tool = metadata_indexer.idx_storage.indexer_configuration_get(
{f"tool_{k}": v for (k, v) in TRANSLATOR_TOOL.items()}
)
assert tool is not None
metadata_indexer.idx_storage.content_metadata_add(
[
ContentMetadataRow(
id=DIRECTORY2.entries[0].target,
indexer_configuration_id=tool["id"],
metadata=YARN_PARSER_METADATA,
)
]
)
metadata_indexer.run([new_rev.id])
results = list(
metadata_indexer.idx_storage.revision_intrinsic_metadata_get([new_rev.id])
)
expected_results = [
RevisionIntrinsicMetadataRow(
id=new_rev.id,
tool=TRANSLATOR_TOOL,
metadata=YARN_PARSER_METADATA,
mappings=["npm"],
)
]
for result in results:
del result.tool["id"]
# then
> self.assertEqual(results, expected_results)
E AssertionError: Lists differ: [Revi[131 chars]': {'context': 'NpmMapping', 'type': 'local'}}[141 chars]=[])] != [Revi[131 chars]': {'type': 'local', 'context': 'NpmMapping'}}[649 chars]m'])]
E
E First differing element 0:
E Revis[130 chars]': {'context': 'NpmMapping', 'type': 'local'}}[140 chars]s=[])
E Revis[130 chars]': {'type': 'local', 'context': 'NpmMapping'}}[648 chars]pm'])
E
E - [RevisionIntrinsicMetadataRow(indexer_configuration_id=None, tool={'name': 'swh-metadata-translator', 'version': '0.0.2', 'configuration': {'context': 'NpmMapping', 'type': 'local'}}, id=b's\xecY\xd2\xee\xe7\x19\xc2)\x85\xac\x00_Z[m\xa5\x8f)b', metadata={'@context': 'https://doi.org/10.5063/schema/codemeta-2.0'}, mappings=[])]
E + [RevisionIntrinsicMetadataRow(indexer_configuration_id=None, tool={'name': 'swh-metadata-translator', 'version': '0.0.2', 'configuration': {'type': 'local', 'context': 'NpmMapping'}}, id=b's\xecY\xd2\xee\xe7\x19\xc2)\x85\xac\x00_Z[m\xa5\x8f)b', metadata={'@context': 'https://doi.org/10.5063/schema/codemeta-2.0', 'url': 'https://github.com/librariesio/yarn-parser#readme', 'codeRepository': 'git+git+https://github.com/librariesio/yarn-parser.git', 'author': [{'type': 'Person', 'name': 'Andrew Nesbitt'}], 'license': 'https://spdx.org/licenses/AGPL-3.0', 'version': '1.0.0', 'description': 'Tiny web service for parsing yarn.lock files', 'issueTracker': 'https://github.com/librariesio/yarn-parser/issues', 'name': 'yarn-parser', 'keywords': ['yarn', 'parse', 'lock', 'dependencies'], 'type': 'SoftwareSourceCode'}, mappings=['npm'])]
.tox/py3/lib/python3.7/site-packages/swh/indexer/tests/test_metadata.py:1337: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Apr 18 2022, 8:43 PM