gnu: python-pygit2: Skip tests requiring network access.
[jackhill/guix/guix.git] / gnu / packages / patches / python-pygit2-disable-network-tests.patch
1 Disable tests trying to look up remote servers.
2
3 diff --git a/test/test_credentials.py b/test/test_credentials.py
4 index 92482d9..9a281e5 100644
5 --- a/test/test_credentials.py
6 +++ b/test/test_credentials.py
7 @@ -68,39 +68,5 @@ class CredentialCreateTest(utils.NoRepoTestCase):
8 self.assertEqual((username, None, None, None), cred.credential_tuple)
9
10
11 -class CredentialCallback(utils.RepoTestCase):
12 - def test_callback(self):
13 - class MyCallbacks(pygit2.RemoteCallbacks):
14 - @staticmethod
15 - def credentials(url, username, allowed):
16 - self.assertTrue(allowed & GIT_CREDTYPE_USERPASS_PLAINTEXT)
17 - raise Exception("I don't know the password")
18 -
19 - url = "https://github.com/github/github"
20 - remote = self.repo.create_remote("github", url)
21 -
22 - self.assertRaises(Exception, lambda: remote.fetch(callbacks=MyCallbacks()))
23 -
24 - def test_bad_cred_type(self):
25 - class MyCallbacks(pygit2.RemoteCallbacks):
26 - @staticmethod
27 - def credentials(url, username, allowed):
28 - self.assertTrue(allowed & GIT_CREDTYPE_USERPASS_PLAINTEXT)
29 - return Keypair("git", "foo.pub", "foo", "sekkrit")
30 -
31 - url = "https://github.com/github/github"
32 - remote = self.repo.create_remote("github", url)
33 - self.assertRaises(TypeError, lambda: remote.fetch(callbacks=MyCallbacks()))
34 -
35 -class CallableCredentialTest(utils.RepoTestCase):
36 -
37 - def test_user_pass(self):
38 - credentials = UserPass("libgit2", "libgit2")
39 - callbacks = pygit2.RemoteCallbacks(credentials=credentials)
40 -
41 - url = "https://bitbucket.org/libgit2/testgitrepository.git"
42 - remote = self.repo.create_remote("bb", url)
43 - remote.fetch(callbacks=callbacks)
44 -
45 if __name__ == '__main__':
46 unittest.main()
47 diff --git a/test/test_repository.py b/test/test_repository.py
48 index cfdf01e..c0d8de4 100644
49 --- a/test/test_repository.py
50 +++ b/test/test_repository.py
51 @@ -538,13 +538,6 @@ class CloneRepositoryTest(utils.NoRepoTestCase):
52 self.assertTrue('refs/remotes/custom_remote/master' in repo.listall_references())
53 self.assertIsNotNone(repo.remotes["custom_remote"])
54
55 - def test_clone_with_credentials(self):
56 - repo = clone_repository(
57 - "https://bitbucket.org/libgit2/testgitrepository.git",
58 - self._temp_dir, callbacks=pygit2.RemoteCallbacks(credentials=pygit2.UserPass("libgit2", "libgit2")))
59 -
60 - self.assertFalse(repo.is_empty)
61 -
62 def test_clone_with_checkout_branch(self):
63 # create a test case which isolates the remote
64 test_repo = clone_repository('./test/data/testrepo.git',