about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gn/packages/check.scm34
-rw-r--r--gn/packages/patches/python-unittest2-python3-compat.patch46
-rw-r--r--gn/packages/patches/python-unittest2-remove-argparse.patch11
-rw-r--r--gn/packages/python.scm3
4 files changed, 92 insertions, 2 deletions
diff --git a/gn/packages/check.scm b/gn/packages/check.scm
index 69c9f1f..960e78e 100644
--- a/gn/packages/check.scm
+++ b/gn/packages/check.scm
@@ -3,7 +3,9 @@
   #:use-module (guix download)
   #:use-module (guix build-system python)
   #:use-module ((guix licenses) #:prefix license:)
-  #:use-module (gnu packages check))
+  #:use-module (gnu packages check)
+  #:use-module (gnu packages python-xyz)
+  #:use-module (past packages python27))
 
 (define-public python-nosexcover
   (package
@@ -27,3 +29,33 @@ to a file named coverage.xml.
 It will honor all the options you pass to the Nose coverage plugin,
 especially -cover-package.")
     (license license:expat)))
+
+(define-public python-unittest2
+  (package
+    (name "python-unittest2")
+    (version "1.1.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "unittest2" version))
+       (patches
+        (search-patches "python-unittest2-python3-compat.patch"
+                        "python-unittest2-remove-argparse.patch"))
+       (sha256
+        (base32
+         "0y855kmx7a8rnf81d3lh5lyxai1908xjp0laf4glwa4c8472m212"))))
+    (build-system python-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _
+             (zero? (system* "python" "-m" "unittest2" "discover" "--verbose")))))))
+    (propagated-inputs
+     (list python-six python-traceback2))
+    (home-page "https://pypi.org/project/unittest2/")
+    (synopsis "Python unit testing library")
+    (description
+     "Unittest2 is a replacement for the unittest module in the Python
+standard library.")
+    (license license:psfl)))
diff --git a/gn/packages/patches/python-unittest2-python3-compat.patch b/gn/packages/patches/python-unittest2-python3-compat.patch
new file mode 100644
index 0000000..68fbcca
--- /dev/null
+++ b/gn/packages/patches/python-unittest2-python3-compat.patch
@@ -0,0 +1,46 @@
+Skip tests that fail with newer versions of Python.
+
+Patch copied from Gentoo:
+
+https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-python/unittest2/files/unittest2-1.1.0-python3.5-test.patch
+
+diff --git a/unittest2/test/test_loader.py b/unittest2/test/test_loader.py
+index 683f662..347eea5 100644
+--- a/unittest2/test/test_loader.py
++++ b/unittest2/test/test_loader.py
+@@ -509,6 +509,7 @@ class Test_TestLoader(unittest2.TestCase):
+     #
+     # What happens when an impossible name is given, relative to the provided
+     # `module`?
++    @unittest.skipIf(sys.version_info[:2] >= (3, 5), "python 3.5 has problems here")
+     def test_loadTestsFromName__relative_malformed_name(self):
+         loader = unittest.TestLoader()
+ 
+@@ -811,6 +812,7 @@ class Test_TestLoader(unittest2.TestCase):
+     # TestCase or TestSuite instance."
+     #
+     # What happens when presented with an impossible module name?
++    @unittest.skipIf(sys.version_info[:2] >= (3, 5), "python 3.5 has problems here")
+     def test_loadTestsFromNames__malformed_name(self):
+         loader = unittest2.TestLoader()
+ 
+@@ -918,6 +920,7 @@ class Test_TestLoader(unittest2.TestCase):
+     # "The method optionally resolves name relative to the given module"
+     #
+     # What happens when presented with an impossible attribute name?
++    @unittest.skipIf(sys.version_info[:2] >= (3, 5), "python 3.5 has problems here")
+     def test_loadTestsFromNames__relative_malformed_name(self):
+         loader = unittest.TestLoader()
+ 
+diff --git a/unittest2/compatibility.py b/unittest2/compatibility.py
+index 9e5f1a5..2d20c19 100644
+--- a/unittest2/compatibility.py
++++ b/unittest2/compatibility.py
+@@ -140,6 +140,6 @@ except ImportError:
+ ###  ChainMap (helper for configparser and string.Template)
+ ########################################################################
+ 
+-class ChainMap(collections.MutableMapping):
++class ChainMap(collections.abc.MutableMapping):
+     ''' A ChainMap groups multiple dicts (or other mappings) together
+     to create a single, updateable view.
diff --git a/gn/packages/patches/python-unittest2-remove-argparse.patch b/gn/packages/patches/python-unittest2-remove-argparse.patch
new file mode 100644
index 0000000..c967387
--- /dev/null
+++ b/gn/packages/patches/python-unittest2-remove-argparse.patch
@@ -0,0 +1,11 @@
+--- a/setup.py	2017-09-12 01:22:06.273997788 +0200
++++ b/setup.py	2017-09-12 01:22:14.297918757 +0200
+@@ -57,7 +57,7 @@
+ # Both install and setup requires - because we read VERSION from within the
+ # package, and the package also exports all the APIs.
+ # six for compat helpers
+-REQUIRES = ['argparse', 'six>=1.4', 'traceback2'],
++REQUIRES = ['six>=1.4', 'traceback2'],
+ 
+ params = dict(
+     name=NAME,
diff --git a/gn/packages/python.scm b/gn/packages/python.scm
index 8175f5e..54d45a4 100644
--- a/gn/packages/python.scm
+++ b/gn/packages/python.scm
@@ -42,7 +42,8 @@
   #:use-module (guix utils)
   #:use-module (guix build-system pyproject)
   #:use-module (guix build-system python)
-  #:use-module (srfi srfi-1))
+  #:use-module (srfi srfi-1)
+  #:use-module (gn packages check))
 
 (define-public python-rpy2-2.9
   (package