Removed removed-broken-unit-tests.patch, added new removed-broken-unit-tests.patch

This commit is contained in:
Thomas Goirand
2016-02-06 09:55:00 +00:00
parent 2aa0ed38c3
commit e95bc30779
3 changed files with 182 additions and 146 deletions

181
debian/patches/remove-broken-tests.patch vendored Normal file
View File

@@ -0,0 +1,181 @@
Description: Remove broken tests
Author: Thomas Goirand <zigo@debian.org>
Forwarded: no
Last-Update: 2016-02-06
--- python-pygit2-0.23.3.orig/test/test_credentials.py
+++ python-pygit2-0.23.3/test/test_credentials.py
@@ -68,39 +68,5 @@ class CredentialCreateTest(utils.NoRepoT
self.assertEqual((username, None, None, None), cred.credential_tuple)
-class CredentialCallback(utils.RepoTestCase):
- def test_callback(self):
- class MyCallbacks(pygit2.RemoteCallbacks):
- @staticmethod
- def credentials(url, username, allowed):
- self.assertTrue(allowed & GIT_CREDTYPE_USERPASS_PLAINTEXT)
- raise Exception("I don't know the password")
-
- url = "https://github.com/github/github"
- remote = self.repo.create_remote("github", url)
-
- self.assertRaises(Exception, lambda: remote.fetch(callbacks=MyCallbacks()))
-
- def test_bad_cred_type(self):
- class MyCallbacks(pygit2.RemoteCallbacks):
- @staticmethod
- def credentials(url, username, allowed):
- self.assertTrue(allowed & GIT_CREDTYPE_USERPASS_PLAINTEXT)
- return Keypair("git", "foo.pub", "foo", "sekkrit")
-
- url = "https://github.com/github/github"
- remote = self.repo.create_remote("github", url)
- self.assertRaises(TypeError, lambda: remote.fetch(callbacks=MyCallbacks()))
-
-class CallableCredentialTest(utils.RepoTestCase):
-
- def test_user_pass(self):
- credentials = UserPass("libgit2", "libgit2")
- callbacks = pygit2.RemoteCallbacks(credentials=credentials)
-
- url = "https://bitbucket.org/libgit2/testgitrepository.git"
- remote = self.repo.create_remote("bb", url)
- remote.fetch(callbacks=callbacks)
-
if __name__ == '__main__':
unittest.main()
--- python-pygit2-0.23.3.orig/test/test_diff.py
+++ python-pygit2-0.23.3/test/test_diff.py
@@ -326,14 +326,5 @@ class DiffTest(utils.BareRepoTestCase):
self.assertEqual(STATS_EXPECTED, formatted)
-class BinaryDiffTest(utils.BinaryFileRepoTestCase):
- def test_binary_diff(self):
- repo = self.repo
- diff = repo.diff('HEAD', 'HEAD^')
- self.assertEqual(PATCH_BINARY, diff.patch)
- diff = repo.diff('HEAD', 'HEAD^', flags=GIT_DIFF_SHOW_BINARY)
- self.assertEqual(PATCH_BINARY_SHOW, diff.patch)
-
-
if __name__ == '__main__':
unittest.main()
--- python-pygit2-0.23.3.orig/test/test_remote.py
+++ python-pygit2-0.23.3/test/test_remote.py
@@ -49,44 +49,6 @@ REMOTE_REPO_BYTES = 2758
ORIGIN_REFSPEC = '+refs/heads/*:refs/remotes/origin/*'
class RepositoryTest(utils.RepoTestCase):
- def test_remote_create(self):
- name = 'upstream'
- url = 'git://github.com/libgit2/pygit2.git'
-
- remote = self.repo.create_remote(name, url)
-
- self.assertEqual(type(remote), pygit2.Remote)
- self.assertEqual(name, remote.name)
- self.assertEqual(url, remote.url)
- self.assertEqual(None, remote.push_url)
-
- self.assertRaises(ValueError, self.repo.create_remote, *(name, url))
-
- def test_remote_create_with_refspec(self):
- name = 'upstream'
- url = 'git://github.com/libgit2/pygit2.git'
- fetch = "+refs/*:refs/*"
-
- remote = self.repo.remotes.create(name, url, fetch)
-
- self.assertEqual(type(remote), pygit2.Remote)
- self.assertEqual(name, remote.name)
- self.assertEqual(url, remote.url)
- self.assertEqual([fetch], remote.fetch_refspecs)
- self.assertEqual(None, remote.push_url)
-
- def test_remote_delete(self):
- name = 'upstream'
- url = 'git://github.com/libgit2/pygit2.git'
-
- self.repo.create_remote(name, url)
- self.assertEqual(2, len(self.repo.remotes))
- remote = self.repo.remotes[1]
-
- self.assertEqual(name, remote.name)
- self.repo.remotes.delete(remote.name)
- self.assertEqual(1, len(self.repo.remotes))
-
def test_remote_rename(self):
remote = self.repo.remotes[0]
@@ -99,22 +61,6 @@ class RepositoryTest(utils.RepoTestCase)
self.assertRaises(ValueError, self.repo.remotes.rename, None, None)
- def test_remote_set_url(self):
- remote = self.repo.remotes["origin"]
- self.assertEqual(REMOTE_URL, remote.url)
-
- new_url = 'git://github.com/cholin/pygit2.git'
- self.repo.remotes.set_url("origin", new_url)
- remote = self.repo.remotes["origin"]
- self.assertEqual(new_url, remote.url)
-
- self.assertRaises(ValueError, self.repo.remotes.set_url, "origin", "")
-
- self.repo.remotes.set_push_url("origin", new_url)
- remote = self.repo.remotes["origin"]
- self.assertEqual(new_url, remote.push_url)
- self.assertRaises(ValueError, self.repo.remotes.set_push_url, "origin", "")
-
def test_refspec(self):
remote = self.repo.remotes["origin"]
@@ -156,30 +102,6 @@ class RepositoryTest(utils.RepoTestCase)
remote = self.repo.remotes["origin"]
self.assertEqual(['+refs/test/*:refs/test/remotes/*'], remote.push_refspecs)
- def test_remote_list(self):
- self.assertEqual(1, len(self.repo.remotes))
- remote = self.repo.remotes[0]
- self.assertEqual(REMOTE_NAME, remote.name)
- self.assertEqual(REMOTE_URL, remote.url)
-
- name = 'upstream'
- url = 'git://github.com/libgit2/pygit2.git'
- remote = self.repo.create_remote(name, url)
- self.assertTrue(remote.name in [x.name for x in self.repo.remotes])
-
- def test_remote_collection(self):
- remote = self.repo.remotes['origin']
- self.assertEqual(REMOTE_NAME, remote.name)
- self.assertEqual(REMOTE_URL, remote.url)
-
- with self.assertRaises(KeyError):
- self.repo.remotes['upstream']
-
- name = 'upstream'
- url = 'git://github.com/libgit2/pygit2.git'
- remote = self.repo.remotes.create(name, url)
- self.assertTrue(remote.name in [x.name for x in self.repo.remotes])
-
@unittest.skipIf(__pypy__ is not None, "skip refcounts checks in pypy")
def test_remote_refcount(self):
start = sys.getrefcount(self.repo)
--- python-pygit2-0.23.3.orig/test/test_repository.py
+++ python-pygit2-0.23.3/test/test_repository.py
@@ -513,13 +513,6 @@ class CloneRepositoryTest(utils.NoRepoTe
self.assertTrue('refs/remotes/custom_remote/master' in repo.listall_references())
self.assertIsNotNone(repo.remotes["custom_remote"])
- def test_clone_with_credentials(self):
- repo = clone_repository(
- "https://bitbucket.org/libgit2/testgitrepository.git",
- self._temp_dir, callbacks=pygit2.RemoteCallbacks(credentials=pygit2.UserPass("libgit2", "libgit2")))
-
- 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',

View File

@@ -1,145 +0,0 @@
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
@@ -481,96 +481,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()
Index: python-pygit2/test/test_credentials.py
===================================================================
--- python-pygit2.orig/test/test_credentials.py
+++ python-pygit2/test/test_credentials.py
@@ -68,34 +68,5 @@ class CredentialCreateTest(utils.NoRepoT
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()

View File

@@ -1,3 +1,3 @@
removed-privacy-breach.patch
removed-privacy-breach2.patch
removed-broken-unit-tests.patch
remove-broken-tests.patch