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