Comment broken tests
And make clone_repository to give more informative errors.
This commit is contained in:
parent
3a3727cdd7
commit
da97e00592
@ -153,7 +153,7 @@ clone_repository(PyObject *self, PyObject *args) {
|
||||
|
||||
err = git_clone(&repo, url, path, &opts);
|
||||
if (err < 0)
|
||||
return Error_set_str(err, path);
|
||||
return Error_set(err);
|
||||
|
||||
git_repository_free(repo);
|
||||
Py_RETURN_NONE;
|
||||
|
@ -40,11 +40,8 @@ from os.path import join, realpath
|
||||
|
||||
# Import from pygit2
|
||||
from pygit2 import GIT_OBJ_ANY, GIT_OBJ_BLOB, GIT_OBJ_COMMIT
|
||||
from pygit2 import (
|
||||
init_repository, clone_repository, discover_repository,
|
||||
Reference, hashfile
|
||||
)
|
||||
from pygit2 import Oid
|
||||
from pygit2 import init_repository, clone_repository, discover_repository
|
||||
from pygit2 import Oid, Reference, hashfile
|
||||
import pygit2
|
||||
from . import utils
|
||||
|
||||
@ -277,7 +274,9 @@ class InitRepositoryTest(utils.NoRepoTestCase):
|
||||
self.assertTrue(repo.is_bare)
|
||||
|
||||
|
||||
|
||||
class DiscoverRepositoryTest(utils.NoRepoTestCase):
|
||||
|
||||
def test_discover_repo(self):
|
||||
repo = init_repository(self._temp_dir, False)
|
||||
subdir = os.path.join(self._temp_dir, "test1", "test2")
|
||||
@ -285,6 +284,7 @@ class DiscoverRepositoryTest(utils.NoRepoTestCase):
|
||||
self.assertEqual(repo.path, discover_repository(subdir))
|
||||
|
||||
|
||||
|
||||
class EmptyRepositoryTest(utils.EmptyRepoTestCase):
|
||||
|
||||
def test_is_empty(self):
|
||||
@ -298,7 +298,9 @@ class EmptyRepositoryTest(utils.EmptyRepoTestCase):
|
||||
self.assertFalse(self.repo.head_is_detached)
|
||||
|
||||
|
||||
|
||||
class CloneRepositoryTest(utils.NoRepoTestCase):
|
||||
|
||||
def test_clone_repository(self):
|
||||
repo_path = "./test/data/testrepo.git/"
|
||||
repo = clone_repository(repo_path, self._temp_dir)
|
||||
@ -319,46 +321,57 @@ class CloneRepositoryTest(utils.NoRepoTestCase):
|
||||
self.assertFalse(repo.is_empty)
|
||||
self.assertEqual(repo.remotes[0].name, "custom_remote")
|
||||
|
||||
def test_clone_push_url(self):
|
||||
repo_path = "./test/data/testrepo.git/"
|
||||
repo = clone_repository(
|
||||
repo_path, self._temp_dir, push_url="custom_push_url"
|
||||
)
|
||||
self.assertFalse(repo.is_empty)
|
||||
# FIXME: When pygit2 supports retrieving the pushurl parameter,
|
||||
# enable this test
|
||||
# self.assertEqual(repo.remotes[0].pushurl, "custom_push_url")
|
||||
|
||||
def test_clone_fetch_spec(self):
|
||||
repo_path = "./test/data/testrepo.git/"
|
||||
## FIXME Uncomment these lines once libgit2 0.20 is released
|
||||
## repo = clone_repository(repo_path, self._temp_dir,
|
||||
## fetch_spec="refs/heads/test")
|
||||
## self.assertFalse(repo.is_empty)
|
||||
# FIXME The tests below are commented because they are broken:
|
||||
#
|
||||
# - test_clone_push_url: Passes, but does nothing useful.
|
||||
#
|
||||
# - test_clone_fetch_spec: Segfaults because of a bug in libgit2 0.19,
|
||||
# this has been fixed already, so wait for 0.20
|
||||
#
|
||||
# - test_clone_push_spec: Passes, but does nothing useful.
|
||||
#
|
||||
# - test_clone_checkout_branch: Fails, because the test fixture does not
|
||||
# have any branch named "test"
|
||||
|
||||
# FIXME: When pygit2 retrieve the fetchspec we passed to git clone.
|
||||
# fetchspec seems to be going through, but the Repository class is
|
||||
# not getting it.
|
||||
# self.assertEqual(repo.remotes[0].fetchspec, "refs/heads/test")
|
||||
# def test_clone_push_url(self):
|
||||
# repo_path = "./test/data/testrepo.git/"
|
||||
# repo = clone_repository(
|
||||
# repo_path, self._temp_dir, push_url="custom_push_url"
|
||||
# )
|
||||
# self.assertFalse(repo.is_empty)
|
||||
# # FIXME: When pygit2 supports retrieving the pushurl parameter,
|
||||
# # enable this test
|
||||
# # self.assertEqual(repo.remotes[0].pushurl, "custom_push_url")
|
||||
|
||||
def test_clone_push_spec(self):
|
||||
repo_path = "./test/data/testrepo.git/"
|
||||
repo = clone_repository(repo_path, self._temp_dir,
|
||||
push_spec="refs/heads/test")
|
||||
self.assertFalse(repo.is_empty)
|
||||
# FIXME: When pygit2 supports retrieving the pushspec parameter,
|
||||
# enable this test
|
||||
# not sure how to test this either... couldn't find pushspec
|
||||
# self.assertEqual(repo.remotes[0].fetchspec, "refs/heads/test")
|
||||
# def test_clone_fetch_spec(self):
|
||||
# repo_path = "./test/data/testrepo.git/"
|
||||
# repo = clone_repository(repo_path, self._temp_dir,
|
||||
# fetch_spec="refs/heads/test")
|
||||
# self.assertFalse(repo.is_empty)
|
||||
# # FIXME: When pygit2 retrieve the fetchspec we passed to git clone.
|
||||
# # fetchspec seems to be going through, but the Repository class is
|
||||
# # not getting it.
|
||||
# # self.assertEqual(repo.remotes[0].fetchspec, "refs/heads/test")
|
||||
|
||||
def test_clone_checkout_branch(self):
|
||||
repo_path = "./test/data/testrepo.git/"
|
||||
repo = clone_repository(repo_path, self._temp_dir,
|
||||
checkout_branch="test")
|
||||
self.assertFalse(repo.is_empty)
|
||||
# FIXME: When pygit2 supports retrieving the current branch,
|
||||
# enable this test
|
||||
# self.assertEqual(repo.remotes[0].current_branch, "test")
|
||||
# def test_clone_push_spec(self):
|
||||
# repo_path = "./test/data/testrepo.git/"
|
||||
# repo = clone_repository(repo_path, self._temp_dir,
|
||||
# push_spec="refs/heads/test")
|
||||
# self.assertFalse(repo.is_empty)
|
||||
# # FIXME: When pygit2 supports retrieving the pushspec parameter,
|
||||
# # enable this test
|
||||
# # not sure how to test this either... couldn't find pushspec
|
||||
# # self.assertEqual(repo.remotes[0].fetchspec, "refs/heads/test")
|
||||
|
||||
# def test_clone_checkout_branch(self):
|
||||
# repo_path = "./test/data/testrepo.git/"
|
||||
# repo = clone_repository(repo_path, self._temp_dir,
|
||||
# checkout_branch="test")
|
||||
# self.assertFalse(repo.is_empty)
|
||||
# # FIXME: When pygit2 supports retrieving the current branch,
|
||||
# # enable this test
|
||||
# # self.assertEqual(repo.remotes[0].current_branch, "test")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user