self = <swh.storage.tests.algos.test_diff.TestDiffRevisions testMethod=test_track_renaming>
mock_get_dir = <MagicMock name='_get_dir' id='139985386412184'>
mock_get_rev = <MagicMock name='_get_rev' id='139986085857824'>
def test_track_renaming(self, mock_get_dir, mock_get_rev):
rev_from = "898ff03e1e7925ecde3da66327d3cdc7e07625ba"
rev_to = "647c3d381e67490e82cdbbe6c96e46d5e1628ce2"
from_dir_model = DirectoryModel()
from_dir_model.add_file(
b"file1_oldname", "ea15f54ca215e7920c60f564315ebb7f911a5204"
)
from_dir_model.add_file(
b"dir1/file1_oldname", "ea15f54ca215e7920c60f564315ebb7f911a5204"
)
from_dir_model.add_file(
b"file2_oldname", "d3c00f9396c6d0277727cec522ff6ad1ea0bc2da"
)
to_dir_model = DirectoryModel()
to_dir_model.add_file(
b"dir1/file1_newname", "ea15f54ca215e7920c60f564315ebb7f911a5204"
)
to_dir_model.add_file(
b"dir2/file1_newname", "ea15f54ca215e7920c60f564315ebb7f911a5204"
)
to_dir_model.add_file(
b"file2_newname", "d3c00f9396c6d0277727cec522ff6ad1ea0bc2da"
)
expected_changes = [
{
"type": "rename",
"from": from_dir_model.get_path_data(b"dir1/file1_oldname"),
"from_path": b"dir1/file1_oldname",
"to": to_dir_model.get_path_data(b"dir1/file1_newname"),
"to_path": b"dir1/file1_newname",
},
{
"type": "rename",
"from": from_dir_model.get_path_data(b"file1_oldname"),
"from_path": b"file1_oldname",
"to": to_dir_model.get_path_data(b"dir2/file1_newname"),
"to_path": b"dir2/file1_newname",
},
{
"type": "rename",
"from": from_dir_model.get_path_data(b"file2_oldname"),
"from_path": b"file2_oldname",
"to": to_dir_model.get_path_data(b"file2_newname"),
"to_path": b"file2_newname",
},
]
self.diff_revisions(
rev_from,
rev_to,
from_dir_model,
to_dir_model,
expected_changes,
mock_get_dir,
> mock_get_rev,
)
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/algos/test_diff.py:388:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/algos/test_diff.py:65: in diff_revisions
None, rev_from_bytes, rev_to_bytes, track_renaming=True
.tox/py3/lib/python3.7/site-packages/swh/storage/algos/diff.py:388: in diff_revisions
from_dir = _get_rev(storage, from_rev)["directory"]
/usr/lib/python3.7/unittest/mock.py:960: in __call__
return _mock_self._mock_call(*args, **kwargs)
/usr/lib/python3.7/unittest/mock.py:1026: in _mock_call
result = effect(*args, **kwargs)
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/algos/test_diff.py:52: in _get_rev
return {"directory": from_dir_model["target"]}
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/algos/test_dir_iterator.py:33: in __getitem__
return hash_to_bytes(directory_identifier(self))
.tox/py3/lib/python3.7/site-packages/swh/model/identifiers.py:52: in directory_identifier
return hash_to_hex(model.Directory.from_dict(directory).id)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'swh.model.model.Directory'>
d = <swh.storage.tests.algos.test_dir_iterator.DirectoryModel object at 0x7f510cebc2e8>
@classmethod
def from_dict(cls, d):
> d = d.copy()
E AttributeError: 'DirectoryModel' object has no attribute 'copy'
.tox/py3/lib/python3.7/site-packages/swh/model/model.py:706: AttributeError
TEST RESULT
TEST RESULT
- Run At
- Sep 28 2021, 5:27 PM