dev-python/future: add Python 3.7, doc, EAPI=7
authorLouis Sautier <sbraz@gentoo.org>
Tue, 21 Aug 2018 14:39:59 +0000 (16:39 +0200)
committerLouis Sautier <sbraz@gentoo.org>
Tue, 21 Aug 2018 14:46:25 +0000 (16:46 +0200)
Closes: https://github.com/gentoo/gentoo/pull/9597
Package-Manager: Portage-2.3.47, Repoman-2.3.10

dev-python/future/files/future-0.16.0-disable-tests-with-internet-connection.patch [new file with mode: 0644]
dev-python/future/files/future-0.16.0-fix-tests-py37.patch [new file with mode: 0644]
dev-python/future/future-0.16.0-r1.ebuild [new file with mode: 0644]

diff --git a/dev-python/future/files/future-0.16.0-disable-tests-with-internet-connection.patch b/dev-python/future/files/future-0.16.0-disable-tests-with-internet-connection.patch
new file mode 100644 (file)
index 0000000..b4ba01e
--- /dev/null
@@ -0,0 +1,50 @@
+##Skipping tests due to connection failures on Fedora build-system
+##See https://github.com/PythonCharmers/python-future/issues/165 
+
+--- a/tests/test_future/test_standard_library.orig.py  2014-11-21 12:52:03.000000000 +0100
++++ b/tests/test_future/test_standard_library.py       2015-09-02 11:37:36.808826777 +0200
+@@ -318,7 +318,7 @@
+         import builtins
+         self.assertTrue(hasattr(builtins, 'tuple'))
+-    # @unittest.skip("ssl support has been stripped out for now ...")
++    @unittest.skip("ConnectionError: ('Connection aborted.', gaierror(-3, 'Temporary failure in name resolution'))...")
+     def test_urllib_request_ssl_redirect(self):
+         """
+         This site redirects to https://...
+@@ -332,6 +332,7 @@
+         # pprint(r.read().decode('utf-8'))
+         self.assertTrue(True)
++    @unittest.skip("ConnectionError: ('Connection aborted.', gaierror(-3, 'Temporary failure in name resolution'))...")
+     def test_moves_urllib_request_http(self):
+         """
+         This site (python-future.org) uses plain http (as of 2014-09-23).
+@@ -343,6 +343,7 @@
+         data = r.read()
+         self.assertTrue(b'</html>' in data)
++    @unittest.skip("ConnectionError: ('Connection aborted.', gaierror(-3, 'Temporary failure in name resolution'))...")
+     def test_urllib_request_http(self):
+         """
+         This site (python-future.org) uses plain http (as of 2014-09-23).
+
+--- a/tests/test_future/test_requests.orig.py  2014-11-21 12:52:03.000000000 +0100
++++ b/tests/test_future/test_requests.py       2015-09-02 11:39:01.509378296 +0200
+@@ -57,6 +57,7 @@
+     This class tests whether the requests module conflicts with the
+     standard library import hooks, as in issue #19.
+     """
++    @unittest.skip("ConnectionError: ('Connection aborted.', gaierror(-3, 'Temporary failure in name resolution'))...")
+     def test_remove_hooks_then_requests(self):
+         code = """
+             from future import standard_library
+@@ -79,6 +80,7 @@
+             self.assertTrue(True)
++    @unittest.skip("ConnectionError: ('Connection aborted.', gaierror(-3, 'Temporary failure in name resolution'))...")
+     def test_requests_cm(self):
+         """
+         Tests whether requests can be used importing standard_library modules
+
diff --git a/dev-python/future/files/future-0.16.0-fix-tests-py37.patch b/dev-python/future/files/future-0.16.0-fix-tests-py37.patch
new file mode 100644 (file)
index 0000000..d925d49
--- /dev/null
@@ -0,0 +1,43 @@
+commit ce4f015978d250718ec8dd9f50721da90a9bd18b
+Author: Louis Sautier <sautier.louis@gmail.com>
+Date:   Mon Aug 20 12:42:29 2018 +0200
+
+    Skip int() keyword tests with Python 3.7
+    
+    The first argument must be positional since
+    https://github.com/python/cpython/commit/2e5642422f6234fd8d0c082142b27340e588f96e
+
+diff --git a/tests/test_future/test_int.py b/tests/test_future/test_int.py
+index f1d9c5d..e306550 100644
+--- a/tests/test_future/test_int.py
++++ b/tests/test_future/test_int.py
+@@ -265,6 +265,9 @@ class IntTestCases(unittest.TestCase):
+     def test_no_args(self):
+         self.assertEqual(int(), 0)
++    @unittest.skipIf(sys.version_info >= (3, 7),
++            "The first parameter must be positional with Python >= 3.7"
++    )
+     def test_keyword_args(self):
+         # Test invoking int() using keyword arguments.
+         self.assertEqual(int(x=1.2), 1)
+
+commit d7a3451753982d944ae0894c9e9f01d0460d03d5
+Author: Louis Sautier <sautier.louis@gmail.com>
+Date:   Mon Aug 20 11:17:59 2018 +0200
+
+    Make test_bad_status_repr work for Python 3.7
+
+diff --git a/tests/test_future/test_httplib.py b/tests/test_future/test_httplib.py
+index 968e933..a1e2b19 100644
+--- a/tests/test_future/test_httplib.py
++++ b/tests/test_future/test_httplib.py
+@@ -197,7 +197,7 @@ class BasicTest(TestCase):
+         if not utils.PY3:
+             self.assertEqual(repr(exc), '''BadStatusLine("u\'\'",)''')
+         else:
+-            self.assertEqual(repr(exc), '''BadStatusLine("\'\'",)''')
++            self.assertIn(repr(exc), ('''BadStatusLine("''",)''', '''BadStatusLine("''")'''))
+     def test_partial_reads(self):
+         # if we have a length, the system knows when to close itself
diff --git a/dev-python/future/future-0.16.0-r1.ebuild b/dev-python/future/future-0.16.0-r1.ebuild
new file mode 100644 (file)
index 0000000..69fc0af
--- /dev/null
@@ -0,0 +1,52 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python{2_7,3_{4,5,6,7}} )
+
+inherit distutils-r1
+
+DESCRIPTION="Easy, clean, reliable Python 2/3 compatibility"
+HOMEPAGE="http://python-future.org/"
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~hppa ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
+IUSE="doc test"
+
+BDEPEND="
+       dev-python/setuptools[${PYTHON_USEDEP}]
+       doc? (
+               dev-python/sphinx[${PYTHON_USEDEP}]
+               dev-python/sphinx-bootstrap-theme[${PYTHON_USEDEP}]
+       )
+       test? (
+               dev-python/numpy[${PYTHON_USEDEP}]
+               dev-python/pytest[${PYTHON_USEDEP}]
+       )
+"
+
+PATCHES=(
+       # https://github.com/PythonCharmers/python-future/issues/165
+       "${FILESDIR}/${P}-disable-tests-with-internet-connection.patch"
+       # https://github.com/PythonCharmers/python-future/pull/355
+       "${FILESDIR}/${P}-fix-tests-py37.patch"
+)
+
+python_prepare_all() {
+       sed -i "/'sphinx.ext.intersphinx'/d" docs/conf.py || die
+       distutils-r1_python_prepare_all
+}
+
+python_compile_all() {
+       if use doc; then
+               sphinx-build docs/ docs/_build/html || die
+               HTML_DOCS=( docs/_build/html/. )
+       fi
+}
+
+python_test() {
+       pytest -vv || die "Tests failed under ${EPYTHON}"
+}