gnu: KDE Frameworks: Update to 5.70.
[jackhill/guix/guix.git] / gnu / packages / patches / python-testtools.patch
1 https://github.com/testing-cabal/testtools/commit/29004731f9c480b7c44a9c2605513d50d372898f.patch
2 Should be fixed in the next release
3
4 From 29004731f9c480b7c44a9c2605513d50d372898f Mon Sep 17 00:00:00 2001
5 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
6 Date: Thu, 17 May 2018 17:52:26 +0200
7 Subject: [PATCH] Fix the tests on Python 3.7
8
9 Exception's repr got changed not to include trailing comma
10
11 Fixes https://github.com/testing-cabal/testtools/issues/270
12 ---
13 .travis.yml | 1 +
14 testtools/tests/matchers/test_exception.py | 11 +++++++++--
15 2 files changed, 10 insertions(+), 2 deletions(-)
16
17 diff --git a/.travis.yml b/.travis.yml
18 index 7f1f4db7..784608e0 100644
19 --- a/.travis.yml
20 +++ b/.travis.yml
21 @@ -5,6 +5,7 @@ python:
22 - "3.4"
23 - "3.5"
24 - "3.6"
25 + - "3.7-dev"
26 - "pypy"
27
28 install:
29 diff --git a/testtools/tests/matchers/test_exception.py b/testtools/tests/matchers/test_exception.py
30 index 6cd80af1..acd39252 100644
31 --- a/testtools/tests/matchers/test_exception.py
32 +++ b/testtools/tests/matchers/test_exception.py
33 @@ -32,15 +32,22 @@ class TestMatchesExceptionInstanceInterface(TestCase, TestMatchersInterface):
34 matches_matches = [error_foo]
35 matches_mismatches = [error_bar, error_base_foo]
36
37 + if sys.version_info >= (3, 7):
38 + # exception's repr has changed
39 + _e = ''
40 + else:
41 + _e = ','
42 +
43 str_examples = [
44 - ("MatchesException(Exception('foo',))",
45 + ("MatchesException(Exception('foo'%s))" % _e,
46 MatchesException(Exception('foo')))
47 ]
48 describe_examples = [
49 ("%r is not a %r" % (Exception, ValueError),
50 error_base_foo,
51 MatchesException(ValueError("foo"))),
52 - ("ValueError('bar',) has different arguments to ValueError('foo',).",
53 + ("ValueError('bar'%s) has different arguments to ValueError('foo'%s)."
54 + % (_e, _e),
55 error_bar,
56 MatchesException(ValueError("foo"))),
57 ]