Пример #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')
Пример #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')
Пример #3
0
 def test_create_empty_read_tree(self):
     index = Index()
     index.read_tree(self.repo['fd937514cb799514d4b81bb24c5fcfeb6472b245'])
Пример #4
0
 def test_create_empty_read_tree(self):
     index = Index()
     index.read_tree(self.repo['fd937514cb799514d4b81bb24c5fcfeb6472b245'])
Пример #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')
Пример #6
0
 def test_create_empty(self):
     Index()
Пример #7
0
 def test_create_empty(self):
     index = Index()
Пример #8
0
def test_create_empty():
    Index()