testing-cabal / testtools

Testtools - tasteful testing for python
https://testtools.readthedocs.io/en/latest/
Other
94 stars 88 forks source link

Tests fail on Python 3.7 #270

Closed hroncok closed 6 years ago

hroncok commented 6 years ago

Hi, I'm preparing an update of Python 3 on Fedora to Python 3.7. Currently, testtools fails to build with Python 3,7, because of a test failure. I've managed to reproduce it on Travis:

https://travis-ci.org/hroncok/testtools/jobs/378123060

$ python -m testtools.run testtools.tests.test_suite
/opt/python/3.7-dev/lib/python3.7/runpy.py:125: RuntimeWarning: 'testtools.run' found in sys.modules after import of package 'testtools', but prior to execution of 'testtools.run'; this may result in unpredictable behaviour
  warn(RuntimeWarning(msg))
Tests running...
======================================================================
FAIL: testtools.tests.matchers.test_exception.TestMatchesExceptionInstanceInterface.test__str__
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/hroncok/testtools/testtools/tests/matchers/helpers.py", line 26, in test__str__
    self.assertThat(matcher, DocTestMatches(expected))
  File "/home/travis/build/hroncok/testtools/testtools/testcase.py", line 498, in assertThat
    raise mismatch_error
testtools.matchers._impl.MismatchError: Expected:
    MatchesException(Exception('foo',))
Got:
    MatchesException(Exception('foo'))
======================================================================
FAIL: testtools.tests.matchers.test_exception.TestMatchesExceptionInstanceInterface.test_describe_difference
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/hroncok/testtools/testtools/tests/matchers/helpers.py", line 33, in test_describe_difference
    self.assertEqual(difference, mismatch.describe())
  File "/home/travis/build/hroncok/testtools/testtools/testcase.py", line 411, in assertEqual
    self.assertThat(observed, matcher, message)
  File "/home/travis/build/hroncok/testtools/testtools/testcase.py", line 498, in assertThat
    raise mismatch_error
testtools.matchers._impl.MismatchError: !=:
reference = "ValueError('bar',) has different arguments to ValueError('foo',)."
actual    = "ValueError('bar') has different arguments to ValueError('foo')."
Ran 2625 tests in 1.219s
FAILED (failures=2)

Travis CI runs 3.7.0a4+, I have the same results with 3.7.0b4.

hroncok commented 6 years ago

It's a change in repr:

Python 3.6.5 ...
>>> Exception('foo',)
Exception('foo',)

Python 3.7.0b3 ...
>>> Exception('foo',)
Exception('foo')