Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.storage.tests.test_cassandra.TestCassandraStorage::test_revision_get
Failed

TEST RESULT

Run At
Jun 4 2020, 11:02 AM
Details
@contextlib.contextmanager def convert_validation_exceptions(): """Catches validation errors arguments, and re-raises a StorageArgumentException.""" try: > yield .tox/py3/lib/python3.7/site-packages/swh/storage/validate.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <swh.storage.validate.ValidatingProxyStorage object at 0x7fb04021b2b0> revisions = [b'56789012345678901234', b'87659012345678904321'] def revision_get( self, revisions: Iterable[bytes] ) -> Generator[Optional[Dict], None, None]: rev_dicts = self.storage.revision_get(revisions) with convert_validation_exceptions(): > for rev_dict in rev_dicts: .tox/py3/lib/python3.7/site-packages/swh/storage/validate.py:87: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <swh.storage.cassandra.storage.CassandraStorage object at 0x7fb0a47caf28> revisions = [b'56789012345678901234', b'87659012345678904321'] def revision_get(self, revisions): rows = self._cql_runner.revision_get(revisions) revs = {} for row in rows: # TODO: use a single query to get all parents? # (it might have lower latency, but requires more code and more # bandwidth, because revision id would be part of each returned # row) parent_rows = self._cql_runner.revision_parent_get(row.id) # parent_rank is the clustering key, so results are already # sorted by rank. parents = [row.parent_id for row in parent_rows] > rev = revision_from_db(row, parents=parents) .tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/storage.py:462: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ db_revision = Row(id=b'56789012345678901234', author=Person(fullname=b'Nicolas Dandrimont <nicolas@example.com> ', name=b'Nicolas Da..."test123"], ["mergetags", ["foo\\\\\\\\bar", "\\"\\\\xaf\\\\x89\\\\x80\\u0001\\\\x00"]]]}', synthetic=True, type='git') parents = [b'01234567890123456789', b'23434512345123456789'] def revision_from_db(db_revision: Row, parents: Tuple[Sha1Git]) -> Revision: revision = db_revision._asdict() # type: ignore metadata = json.loads(revision.pop("metadata", None)) if metadata and "extra_headers" in metadata: extra_headers = db_to_git_headers(metadata["extra_headers"]) metadata["extra_headers"] = extra_headers return Revision( parents=parents, type=RevisionType(revision.pop("type")), metadata=metadata, > **revision, ) .tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/converters.py:51: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Revision(message=b'hello', author=Person(fullname=b'Nicolas Dandrimont <nicolas@example.com> ', name=b'Nicolas Dandrim..., b'"\xaf\x89\x80\x01\x00']]]}, parents=[b'01234567890123456789', b'23434512345123456789'], id=b'56789012345678901234') message = b'hello' author = Person(fullname=b'Nicolas Dandrimont <nicolas@example.com> ', name=b'Nicolas Dandrimont', email=b'nicolas@example.com') committer = Person(fullname=b'St\xc3fano Zacchiroli <stefano@example.com>', name=b'St\xc3fano Zacchiroli', email=b'stefano@example.com') date = TimestampWithTimezone(timestamp=Timestamp(seconds=1234567890, microseconds=0), offset=120, negative_utc=False) committer_date = TimestampWithTimezone(timestamp=Timestamp(seconds=1123456789, microseconds=0), offset=0, negative_utc=True) type = <RevisionType.GIT: 'git'> directory = b'4\x013B2S1\x000\xf51\xe62\xa73\xff7\xc3\xa90', synthetic = True metadata = {'checksums': {'sha1': 'tarball-sha1', 'sha256': 'tarball-sha256'}, 'extra_headers': [['gpgsig', b'test123'], ['mergetags', [b'foo\\bar', b'"\xaf\x89\x80\x01\x00']]], 'signed-off-by': 'some-dude'} parents = [b'01234567890123456789', b'23434512345123456789'] id = b'56789012345678901234' def __init__(self, message, author, committer, date, committer_date, type, directory, synthetic, metadata=attr_dict['metadata'].default, parents=attr_dict['parents'].default, id=attr_dict['id'].default): _inst_dict = self.__dict__ _inst_dict['message'] = message _inst_dict['author'] = author _inst_dict['committer'] = committer _inst_dict['date'] = date _inst_dict['committer_date'] = committer_date _inst_dict['type'] = type _inst_dict['directory'] = directory _inst_dict['synthetic'] = synthetic _inst_dict['metadata'] = metadata _inst_dict['parents'] = parents _inst_dict['id'] = id if _config._run_validators is True: __attr_validator_message(self, __attr_message, self.message) __attr_validator_author(self, __attr_author, self.author) __attr_validator_committer(self, __attr_committer, self.committer) __attr_validator_date(self, __attr_date, self.date) __attr_validator_committer_date(self, __attr_committer_date, self.committer_date) __attr_validator_type(self, __attr_type, self.type) __attr_validator_directory(self, __attr_directory, self.directory) __attr_validator_synthetic(self, __attr_synthetic, self.synthetic) __attr_validator_metadata(self, __attr_metadata, self.metadata) > __attr_validator_parents(self, __attr_parents, self.parents) <attrs generated init swh.model.model.Revision>:24: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ instance = Revision(message=b'hello', author=Person(fullname=b'Nicolas Dandrimont <nicolas@example.com> ', name=b'Nicolas Dandrim..., b'"\xaf\x89\x80\x01\x00']]]}, parents=[b'01234567890123456789', b'23434512345123456789'], id=b'56789012345678901234') attribute = Attribute(name='parents', default=(), validator=<function type_validator.<locals>._validator at 0x7fb0c52282f0>, repr=...er=True, hash=None, init=True, metadata=mappingproxy({}), type=typing.Tuple[bytes, ...], converter=None, kw_only=False) field = [b'01234567890123456789', b'23434512345123456789'] def _validator(instance, attribute, field): if not empty_ok and not field: raise EmptyError(field, attribute) > _validate_elements(attribute, field, attribute.type) .tox/py3/lib/python3.7/site-packages/attrs_strict/_type_validation.py:63: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ attribute = Attribute(name='parents', default=(), validator=<function type_validator.<locals>._validator at 0x7fb0c52282f0>, repr=...er=True, hash=None, init=True, metadata=mappingproxy({}), type=typing.Tuple[bytes, ...], converter=None, kw_only=False) value = [b'01234567890123456789', b'23434512345123456789'] expected_type = typing.Tuple[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 base_type != typing.Union and not isinstance( # type: ignore value, base_type ): > raise AttributeTypeError(value, attribute) E attrs_strict._error.AttributeTypeError: parents must be typing.Tuple[bytes, ...] (got [b'01234567890123456789', b'23434512345123456789'] that is a <class 'list'>) .tox/py3/lib/python3.7/site-packages/attrs_strict/_type_validation.py:80: AttributeTypeError During handling of the above exception, another exception occurred: self = <swh.storage.tests.test_cassandra.TestCassandraStorage object at 0x7fb06015f240> swh_storage = <swh.storage.validate.ValidatingProxyStorage object at 0x7fb04021b2b0> def test_revision_get(self, swh_storage): swh_storage.revision_add([data.revision]) actual_revisions = list( > swh_storage.revision_get([data.revision["id"], data.revision2["id"]]) ) .tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_storage.py:1094: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ .tox/py3/lib/python3.7/site-packages/swh/storage/validate.py:87: in revision_get for rev_dict in rev_dicts: /usr/lib/python3.7/contextlib.py:130: in __exit__ self.gen.throw(type, value, traceback) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ @contextlib.contextmanager def convert_validation_exceptions(): """Catches validation errors arguments, and re-raises a StorageArgumentException.""" try: yield except tuple(VALIDATION_EXCEPTIONS) as e: > raise StorageArgumentException(str(e)) E swh.storage.exc.StorageArgumentException: parents must be typing.Tuple[bytes, ...] (got [b'01234567890123456789', b'23434512345123456789'] that is a <class 'list'>) .tox/py3/lib/python3.7/site-packages/swh/storage/validate.py:40: StorageArgumentException