commit:     10ab70cfc107dddbdbc4dae4a40de7df5788a708
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 12 21:49:53 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jul 12 21:54:12 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=10ab70cf

dev-python/testtools: Backport py3.7 test fix

 .../testtools/files/testtools-2.3.0-py37.patch     | 44 ++++++++++++++++++++++
 dev-python/testtools/testtools-2.3.0.ebuild        |  6 ++-
 2 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/dev-python/testtools/files/testtools-2.3.0-py37.patch 
b/dev-python/testtools/files/testtools-2.3.0-py37.patch
new file mode 100644
index 00000000000..0f2da043ffe
--- /dev/null
+++ b/dev-python/testtools/files/testtools-2.3.0-py37.patch
@@ -0,0 +1,44 @@
+https://github.com/testing-cabal/testtools/commit/29004731f9c480b7c44a9c2605513d50d372898f.patch
+
+From 29004731f9c480b7c44a9c2605513d50d372898f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <[email protected]>
+Date: Thu, 17 May 2018 17:52:26 +0200
+Subject: [PATCH] Fix the tests on Python 3.7
+
+Exception's repr got changed not to include trailing comma
+
+Fixes https://github.com/testing-cabal/testtools/issues/270
+---
+ .travis.yml                                |  1 +
+ testtools/tests/matchers/test_exception.py | 11 +++++++++--
+ 2 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/testtools/tests/matchers/test_exception.py 
b/testtools/tests/matchers/test_exception.py
+index 6cd80af1..acd39252 100644
+--- a/testtools/tests/matchers/test_exception.py
++++ b/testtools/tests/matchers/test_exception.py
+@@ -32,15 +32,22 @@ class TestMatchesExceptionInstanceInterface(TestCase, 
TestMatchersInterface):
+     matches_matches = [error_foo]
+     matches_mismatches = [error_bar, error_base_foo]
+ 
++    if sys.version_info >= (3, 7):
++        # exception's repr has changed
++        _e = ''
++    else:
++        _e = ','
++
+     str_examples = [
+-        ("MatchesException(Exception('foo',))",
++        ("MatchesException(Exception('foo'%s))" % _e,
+          MatchesException(Exception('foo')))
+         ]
+     describe_examples = [
+         ("%r is not a %r" % (Exception, ValueError),
+          error_base_foo,
+          MatchesException(ValueError("foo"))),
+-        ("ValueError('bar',) has different arguments to ValueError('foo',).",
++        ("ValueError('bar'%s) has different arguments to ValueError('foo'%s)."
++         % (_e, _e),
+          error_bar,
+          MatchesException(ValueError("foo"))),
+         ]

diff --git a/dev-python/testtools/testtools-2.3.0.ebuild 
b/dev-python/testtools/testtools-2.3.0.ebuild
index 0ec501a3f0e..e37da41b3e7 100644
--- a/dev-python/testtools/testtools-2.3.0.ebuild
+++ b/dev-python/testtools/testtools-2.3.0.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -38,6 +38,10 @@ DEPEND="
 RDEPEND="${CDEPEND}"
 PDEPEND=">=dev-python/fixtures-1.3.0[${PYTHON_USEDEP}]"
 
+PATCHES=(
+       "${FILESDIR}"/testtools-2.3.0-py37.patch
+)
+
 python_compile_all() {
        use doc && emake -C doc html
 }

Reply via email to