summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2017-02-14 00:01:59 +0100
committerMarius Bakke <mbakke@fastmail.com>2017-02-14 00:04:59 +0100
commitbb6043fe9f0198c1e253ae2a8adeea1337830265 (patch)
tree6e283919ea6ce50def125ee85859105d90af6ae9 /gnu
parent97b62eb0bfcf5eb7e1e5a320f779839d13052ad0 (diff)
downloadguix-bb6043fe9f0198c1e253ae2a8adeea1337830265.tar.gz
gnu: python-pygit2: Skip tests requiring network access.
* gnu/packages/python.scm (python-pygit2, python2-pygit2)[source](patches):
New field.
* gnu/packages/patches/python-pygit2-disable-network-tests.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/patches/python-pygit2-disable-network-tests.patch64
-rw-r--r--gnu/packages/python.scm4
3 files changed, 68 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 8615d12b08..0b9b5b1a1e 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -861,6 +861,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-configobj-setuptools.patch	\
   %D%/packages/patches/python-paste-remove-website-test.patch	\
   %D%/packages/patches/python-paste-remove-timing-test.patch	\
+  %D%/packages/patches/python-pygit2-disable-network-tests.patch	\
   %D%/packages/patches/python-pyopenssl-skip-network-test.patch	\
   %D%/packages/patches/python-pycrypto-CVE-2013-7459.patch	\
   %D%/packages/patches/python2-pygobject-2-gi-info-type-error-domain.patch \
diff --git a/gnu/packages/patches/python-pygit2-disable-network-tests.patch b/gnu/packages/patches/python-pygit2-disable-network-tests.patch
new file mode 100644
index 0000000000..e46d244807
--- /dev/null
+++ b/gnu/packages/patches/python-pygit2-disable-network-tests.patch
@@ -0,0 +1,64 @@
+Disable tests trying to look up remote servers.
+
+diff --git a/test/test_credentials.py b/test/test_credentials.py
+index 92482d9..9a281e5 100644
+--- a/test/test_credentials.py
++++ b/test/test_credentials.py
+@@ -68,39 +68,5 @@ class CredentialCreateTest(utils.NoRepoTestCase):
+         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()
+diff --git a/test/test_repository.py b/test/test_repository.py
+index cfdf01e..c0d8de4 100644
+--- a/test/test_repository.py
++++ b/test/test_repository.py
+@@ -538,13 +538,6 @@ class CloneRepositoryTest(utils.NoRepoTestCase):
+         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',
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 13dc698341..c9cf347373 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -3580,7 +3580,9 @@ association studies (GWAS) on extremely large data sets.")
        (uri (pypi-uri "pygit2" version))
        (sha256
         (base32
-         "0wf5rp0fvrw7j3j18dvwjq6xqlbm611wd55aphrfpps0v1gxh3ny"))))
+         "0wf5rp0fvrw7j3j18dvwjq6xqlbm611wd55aphrfpps0v1gxh3ny"))
+       (patches
+        (search-patches "python-pygit2-disable-network-tests.patch"))))
     (build-system python-build-system)
     (propagated-inputs
      `(("python-six" ,python-six)