Exemplo n.º 1
0
    def check_writing(self, treeish, timestamp=None):
        archive = tarfile.open('foo.tar', mode='w')
        self.repo.write_archive(treeish, archive)

        index = Index()
        if isinstance(treeish, Object):
            index.read_tree(treeish.peel(Tree))
        else:
            index.read_tree(self.repo[treeish].peel(Tree))

        self.assertEqual(len(index), len(archive.getmembers()))

        if timestamp:
            fileinfo = archive.getmembers()[0]
            self.assertEqual(timestamp, fileinfo.mtime)

        archive.close()
        self.assertTrue(os.path.isfile('foo.tar'))
        os.remove('foo.tar')
Exemplo n.º 2
0
    def check_writing(self, treeish, timestamp=None):
        archive = tarfile.open('foo.tar', mode='w')
        self.repo.write_archive(treeish, archive)

        index = Index()
        if isinstance(treeish, Object):
            index.read_tree(treeish.peel(Tree))
        else:
            index.read_tree(self.repo[treeish].peel(Tree))

        assert len(index) == len(archive.getmembers())

        if timestamp:
            fileinfo = archive.getmembers()[0]
            assert timestamp == fileinfo.mtime

        archive.close()
        assert os.path.isfile('foo.tar')
        os.remove('foo.tar')
Exemplo n.º 3
0
 def test_create_empty_read_tree(self):
     index = Index()
     index.read_tree(self.repo['fd937514cb799514d4b81bb24c5fcfeb6472b245'])
Exemplo n.º 4
0
 def test_create_empty_read_tree(self):
     index = Index()
     index.read_tree(self.repo['fd937514cb799514d4b81bb24c5fcfeb6472b245'])
Exemplo n.º 5
0
 def test_create_empty_read_tree_as_string(self):
     index = Index()
     # no repo associated, so we don't know where to read from
     with pytest.raises(TypeError):
         index('read_tree', 'fd937514cb799514d4b81bb24c5fcfeb6472b245')
Exemplo n.º 6
0
 def test_create_empty(self):
     Index()
Exemplo n.º 7
0
 def test_create_empty(self):
     index = Index()
Exemplo n.º 8
0
def test_create_empty():
    Index()