コード例 #1
0
ファイル: test_archive.py プロジェクト: Javacym/pygit2
    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
ファイル: test_index.py プロジェクト: flowroute/pygit2
 def test_create_empty_read_tree(self):
     index = Index()
     index.read_tree(self.repo['fd937514cb799514d4b81bb24c5fcfeb6472b245'])
コード例 #4
0
ファイル: test_index.py プロジェクト: southdy/pygit2
 def test_create_empty_read_tree(self):
     index = Index()
     index.read_tree(self.repo['fd937514cb799514d4b81bb24c5fcfeb6472b245'])
コード例 #5
0
ファイル: test_index.py プロジェクト: southdy/pygit2
 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
ファイル: test_index.py プロジェクト: southdy/pygit2
 def test_create_empty(self):
     Index()
コード例 #7
0
 def test_create_empty(self):
     index = Index()
コード例 #8
0
ファイル: test_index.py プロジェクト: uniphil/pygit2
def test_create_empty():
    Index()