Skip to content

Commit

Permalink
Merge pull request #271 from hroncok/py37
Browse files Browse the repository at this point in the history
Fix the tests on Python 3.7
  • Loading branch information
jelmer authored Jun 4, 2018
2 parents fff4243 + 2900473 commit f865cfe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ python:
- "3.4"
- "3.5"
- "3.6"
- "3.7-dev"
- "pypy"

install:
Expand Down
11 changes: 9 additions & 2 deletions testtools/tests/matchers/test_exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))),
]
Expand Down

0 comments on commit f865cfe

Please sign in to comment.