self = <swh.vault.tests.test_cookers.TestRevisionCooker object at 0x7f2201e73c50>
git_loader = <function git_loader.<locals>._create_loader at 0x7f220318cd08>
cook_extract_revision = <function cook_extract_revision_git_bare at 0x7f2203a5c0d0>
def test_revision_filtered_objects(self, git_loader, cook_extract_revision):
repo = TestRepo()
with repo as rp:
file_1, id_1 = hash_content(b"test1")
file_2, id_2 = hash_content(b"test2")
file_3, id_3 = hash_content(b"test3")
(rp / "file").write_bytes(file_1)
(rp / "hidden_file").write_bytes(file_2)
(rp / "absent_file").write_bytes(file_3)
repo.commit()
obj_id_hex = repo.repo.refs[b"HEAD"].decode()
obj_id = hashutil.hash_to_bytes(obj_id_hex)
loader = git_loader(str(rp))
loader.load()
# FIXME: storage.content_update() should be changed to allow things
# like that
with loader.storage.get_db().transaction() as cur:
cur.execute(
"""update content set status = 'visible'
where sha1 = %s""",
(id_1,),
)
cur.execute(
"""update content set status = 'hidden'
where sha1 = %s""",
(id_2,),
)
cur.execute(
"""update content set status = 'absent'
where sha1 = %s""",
(id_3,),
)
> with cook_extract_revision(loader.storage, obj_id) as (ert, p):
.tox/py3/lib/python3.7/site-packages/swh/vault/tests/test_cookers.py:692:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/contextlib.py:112: in __enter__
return next(self.gen)
.tox/py3/lib/python3.7/site-packages/swh/vault/tests/test_cookers.py:299: in cook_extract_revision_git_bare
cooker.prepare_bundle()
.tox/py3/lib/python3.7/site-packages/swh/vault/cookers/git_bare.py:104: in prepare_bundle
self.load_objects()
.tox/py3/lib/python3.7/site-packages/swh/vault/cookers/git_bare.py:231: in load_objects
self.load_contents(content_ids)
.tox/py3/lib/python3.7/site-packages/swh/vault/cookers/git_bare.py:309: in load_contents
contents = self.storage.content_get(obj_ids, "sha1_git")
.tox/py3/lib/python3.7/site-packages/swh/storage/metrics.py:24: in d
return f(*a, **kw)
.tox/py3/lib/python3.7/site-packages/swh/core/db/common.py:62: in _meth
return meth(self, *args, db=db, cur=cur, **kwargs)
.tox/py3/lib/python3.7/site-packages/swh/storage/postgresql/storage.py:336: in content_get
content = Content(**row_d)
<attrs generated init swh.model.model.Content>:17: in __init__
__attr_validator_status(self, __attr_status, self.status)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <in_ validator with options ['visible', 'hidden']>
inst = Content(sha1=b'>\xbf\xa3\x01\xdcY\x19o\x18Y<E\xe5\x19(z#)u\x89', sha1_git=b')\xf4F\xaf\xe2LM\xbaB\xa3\xaa,\x9dK\xa3\xc...6\x81\xa3)\xcf\x08=\xd7;\x07\xc4v\xcc\xf91f\x1a\n\xe9I\xaf\xde\xdan', length=5, status='absent', data=None, ctime=None)
attr = Attribute(name='status', default='visible', validator=<in_ validator with options ['visible', 'hidden']>, repr=True, e...t=True, metadata=mappingproxy({}), type=<class 'str'>, converter=None, kw_only=False, inherited=False, on_setattr=None)
value = 'absent'
def __call__(self, inst, attr, value):
try:
in_options = value in self.options
except TypeError: # e.g. `1 in "abc"`
in_options = False
if not in_options:
raise ValueError(
"'{name}' must be in {options!r} (got {value!r})".format(
> name=attr.name, options=self.options, value=value
)
)
E ValueError: 'status' must be in ['visible', 'hidden'] (got 'absent')
.tox/py3/lib/python3.7/site-packages/attr/validators.py:231: ValueError
TEST RESULT
TEST RESULT
- Run At
- May 28 2021, 2:34 PM