swh_config = '/tmp/pytest-of-jenkins/pytest-0/test_loader_svn_visit_with_cha0/loader.yml'
datadir = '/var/lib/jenkins/workspace/DLDSVN/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/loader/svn/tests/data'
tmp_path = PosixPath('/tmp/pytest-of-jenkins/pytest-0/test_loader_svn_visit_with_cha0')
def test_loader_svn_visit_with_changes(swh_config, datadir, tmp_path):
"""In this scenario, the repository has been updated with new changes.
The loading visit should result in new objects stored and 1 new
snapshot.
"""
archive_name = "pkg-gourmet"
archive_path = os.path.join(datadir, f"{archive_name}.tgz")
repo_initial_url = prepare_repository_from_archive(
archive_path, archive_name, tmp_path
)
# repo_initial_url becomes the origin_url we want to visit some more below
loader = SvnLoader(repo_initial_url)
assert loader.load() == {"status": "eventful"}
visit_status1 = assert_last_visit_matches(
loader.storage,
repo_initial_url,
status="full",
type="svn",
snapshot=GOURMET_SNAPSHOT,
)
archive_path = os.path.join(datadir, "pkg-gourmet-with-updates.tgz")
repo_updated_url = prepare_repository_from_archive(
archive_path, "pkg-gourmet", tmp_path
)
loader = SvnLoader(repo_updated_url, origin_url=repo_initial_url,)
assert loader.load() == {"status": "eventful"}
visit_status2 = assert_last_visit_matches(
loader.storage,
repo_updated_url,
status="full",
type="svn",
snapshot=GOURMET_UPDATES_SNAPSHOT,
)
assert visit_status1.date < visit_status2.date
assert visit_status1.snapshot != visit_status2.snapshot
stats = get_stats(loader.storage)
assert stats == {
"content": 22,
"directory": 28,
"origin": 1,
"origin_visit": 2,
"person": 2,
"release": 0,
"revision": 11,
"skipped_content": 0,
"snapshot": 2,
}
expected_snapshot = {
"id": GOURMET_UPDATES_SNAPSHOT,
"branches": {
"HEAD": {
"target": "171dc35522bfd17dda4e90a542a0377fb2fc707a",
"target_type": "revision",
}
},
}
> check_snapshot(expected_snapshot, loader.storage)
.tox/py3/lib/python3.7/site-packages/swh/loader/svn/tests/test_loader.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/loader/tests/__init__.py:139: in check_snapshot
snapshot = Snapshot.from_dict(snapshot)
.tox/py3/lib/python3.7/site-packages/swh/model/model.py:370: in from_dict
for (name, branch) in d.pop("branches").items()
.tox/py3/lib/python3.7/site-packages/swh/model/collections.py:27: in __init__
self.data = tuple(data)
.tox/py3/lib/python3.7/site-packages/swh/model/model.py:370: in <genexpr>
for (name, branch) in d.pop("branches").items()
.tox/py3/lib/python3.7/site-packages/swh/model/model.py:344: in from_dict
return cls(target=d["target"], target_type=TargetType(d["target_type"]))
<attrs generated init swh.model.model.SnapshotBranch>:6: in __init__
__attr_validator_target(self, __attr_target, self.target)
.tox/py3/lib/python3.7/site-packages/attr/_make.py:2146: in __call__
v(inst, attr, value)
.tox/py3/lib/python3.7/site-packages/attrs_strict/_type_validation.py:95: in _validator
_validate_elements(attribute, field, attribute.type)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attribute = Attribute(name='target', default=NOTHING, validator=_AndValidator(_validators=(<function type_validator.<locals>._vali...True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=<class 'bytes'>, converter=None, kw_only=False)
value = '171dc35522bfd17dda4e90a542a0377fb2fc707a'
expected_type = <class '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 isinstance(base_type, (str, ForwardRef)):
# These base_types happen when you have string annotations and cannot
# be used in isinstance.
raise _StringAnnotationError()
if base_type != typing.Union and not isinstance( # type: ignore
value, base_type
):
> raise AttributeTypeError(value, attribute)
E attrs_strict._error.AttributeTypeError: target must be <class 'bytes'> (got 171dc35522bfd17dda4e90a542a0377fb2fc707a that is a <class 'str'>)
.tox/py3/lib/python3.7/site-packages/attrs_strict/_type_validation.py:120: AttributeTypeError
TEST RESULT
TEST RESULT
- Run At
- Jul 17 2020, 10:42 AM