Beispiel #1
0
    def test_transforms_inode(self, get_inode_mock):
        state = State(self.dvc, self.dvc.config.config)
        inode = state.MAX_INT + 2
        self.assertNotEqual(inode, state._to_sqlite(inode))

        path = os.path.join(self.dvc.root_dir, self.FOO)
        get_inode_mock.side_effect = self.mock_get_inode(path, inode)

        with state:
            state.update(path)
            ret = state.get_state_record_for_inode(inode)
            self.assertIsNotNone(ret)
Beispiel #2
0
    def test_transforms_inode(self, get_inode_mock):
        state = State(self.dvc, self.dvc.config.config)
        inode = state.MAX_INT + 2
        self.assertNotEqual(inode, state._to_sqlite(inode))

        path = os.path.join(self.dvc.root_dir, self.FOO)
        md5 = file_md5(path)[0]
        get_inode_mock.side_effect = self.mock_get_inode(path, inode)

        with state:
            state.save({"scheme": "local", "path": path}, md5)
            ret = state.get_state_record_for_inode(inode)
            self.assertIsNotNone(ret)
Beispiel #3
0
def test_get_state_record_for_inode(get_inode_mock, dvc_repo, repo_dir):
    state = State(dvc_repo, dvc_repo.config.config)
    inode = state.MAX_INT + 2
    assert inode != state._to_sqlite(inode)

    path = os.path.join(dvc_repo.root_dir, repo_dir.FOO)
    md5 = file_md5(path)[0]
    get_inode_mock.side_effect = mock_get_inode(inode)

    with state:
        state.save(PathInfo(path), md5)
        ret = state.get_state_record_for_inode(inode)
        assert ret is not None
Beispiel #4
0
def test_get_state_record_for_inode(get_inode_mock, tmp_dir, dvc):
    tmp_dir.gen("foo", "foo content")

    state = State(dvc, dvc.config.config)
    inode = state.MAX_INT + 2
    assert inode != state._to_sqlite(inode)

    foo = tmp_dir / "foo"
    md5 = file_md5(foo)[0]
    get_inode_mock.side_effect = mock_get_inode(inode)

    with state:
        state.save(PathInfo(foo), md5)
        ret = state.get_state_record_for_inode(inode)
        assert ret is not None