Files
deb-python-pygit2/debian/patches/removed-broken-unit-tests.patch
2015-06-08 14:57:27 +02:00

144 lines
5.9 KiB
Diff

Description: Removed broken unit tests
Author: Thomas Goirand <zigo@debian.org>
Forwarded: no
Last-Update: 2015-06-08
Index: python-pygit2/test/test_repository.py
===================================================================
--- python-pygit2.orig/test/test_repository.py
+++ python-pygit2/test/test_repository.py
@@ -425,96 +425,5 @@ class EmptyRepositoryTest(utils.EmptyRep
self.assertTrue(self.repo.head_is_unborn)
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)
- self.assertFalse(repo.is_empty)
- self.assertFalse(repo.is_bare)
-
- def test_clone_bare_repository(self):
- repo_path = "./test/data/testrepo.git/"
- repo = clone_repository(repo_path, self._temp_dir, bare=True)
- self.assertFalse(repo.is_empty)
- self.assertTrue(repo.is_bare)
-
- def test_clone_repository_and_remote_callbacks(self):
- src_repo_relpath = "./test/data/testrepo.git/"
- repo_path = os.path.join(self._temp_dir, "clone-into")
- url = 'file://' + os.path.realpath(src_repo_relpath)
-
- def create_repository(path, bare):
- return init_repository(path, bare)
-
- # here we override the name
- def create_remote(repo, name, url):
- return repo.remotes.create("custom_remote", url)
-
- repo = clone_repository(url, repo_path, repository=create_repository, remote=create_remote)
- self.assertFalse(repo.is_empty)
- self.assertTrue('refs/remotes/custom_remote/master' in repo.listall_references())
- self.assertIsNotNone(repo.remotes["custom_remote"])
-
- def test_clone_with_credentials(self):
- credentials = pygit2.UserPass("libgit2", "libgit2")
- repo = clone_repository(
- "https://bitbucket.org/libgit2/testgitrepository.git",
- self._temp_dir, credentials=credentials)
-
- self.assertFalse(repo.is_empty)
-
- def test_clone_with_checkout_branch(self):
- # create a test case which isolates the remote
- test_repo = clone_repository('./test/data/testrepo.git',
- os.path.join(self._temp_dir, 'testrepo-orig.git'),
- bare=True)
- test_repo.create_branch('test', test_repo[test_repo.head.target])
- repo = clone_repository(test_repo.path,
- os.path.join(self._temp_dir, 'testrepo.git'),
- checkout_branch='test', bare=True)
- self.assertEqual(repo.lookup_reference('HEAD').target, 'refs/heads/test')
-
- # 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.
- #
-
-# 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/"
-# 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_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")
-
if __name__ == '__main__':
unittest.main()
--- python-pygit2/test/test_credentials.py.orig 2015-06-08 14:55:39.908105308 +0200
+++ python-pygit2/test/test_credentials.py 2015-06-08 14:55:53.232044015 +0200
@@ -68,34 +68,5 @@
self.assertEqual((username, None, None, None), cred.credential_tuple)
-class CredentialCallback(utils.RepoTestCase):
- def test_callback(self):
- def credentials_cb(url, username, allowed):
- self.assertTrue(allowed & GIT_CREDTYPE_USERPASS_PLAINTEXT)
- raise Exception("I don't know the password")
-
- remote = self.repo.create_remote("github", "https://github.com/github/github")
- remote.credentials = credentials_cb
-
- self.assertRaises(Exception, remote.fetch)
-
- def test_bad_cred_type(self):
- def credentials_cb(url, username, allowed):
- self.assertTrue(allowed & GIT_CREDTYPE_USERPASS_PLAINTEXT)
- return Keypair("git", "foo.pub", "foo", "sekkrit")
-
- remote = self.repo.create_remote("github", "https://github.com/github/github")
- remote.credentials = credentials_cb
-
- self.assertRaises(TypeError, remote.fetch)
-
-class CallableCredentialTest(utils.RepoTestCase):
-
- def test_user_pass(self):
- remote = self.repo.create_remote("bb", "https://bitbucket.org/libgit2/testgitrepository.git")
- remote.credentials = UserPass("libgit2", "libgit2")
-
- remote.fetch()
-
if __name__ == '__main__':
unittest.main()