testtools-dev team mailing list archive
-
testtools-dev team
-
Mailing list archive
-
Message #00428
[Bug 688719] Re: MatchesException broken with Python 2.4
** Changed in: testtools
Status: Triaged => Fix Committed
** Changed in: testtools
Assignee: (unassigned) => Martin [gz] (gz)
--
You received this bug notification because you are a member of testtools
developers, which is subscribed to testtools.
https://bugs.launchpad.net/bugs/688719
Title:
MatchesException broken with Python 2.4
Status in testtools:
Fix Committed
Bug description:
The MatchesException matcher is broken with Python 2.4. I suspect this is due to an old-style / new-style thing.
Note that tests which rely on MatchesException also break.
$ PYTHONPATH=/home/jml/src/testtools python2.4 testtools/run.py testtools.tests.test_matchers
Tests running...
======================================================================
FAIL: testtools.tests.test_matchers.TestMatchesExceptionInstanceInterface.test__str__
----------------------------------------------------------------------
Text attachment: traceback
------------
Traceback (most recent call last):
File "/home/jml/src/testtools/testtools/runtest.py", line 169, in _run_user
return fn(*args, **kwargs)
File "/home/jml/src/testtools/testtools/testcase.py", line 498, in _run_test_method
return self._get_test_method()()
File "/home/jml/src/testtools/testtools/tests/test_matchers.py", line 68, in test__str__
self.assertThat(matcher, DocTestMatches(expected))
File "/home/jml/src/testtools/testtools/testcase.py", line 343, in assertThat
self.fail('Match failed. Matchee: "%s"\nMatcher: %s\nDifference: %s\n'
AssertionError: Match failed. Matchee: "MatchesException(<exceptions.Exception instance at 0xb7385e6c>)"
Matcher: DocTestMatches("MatchesException(Exception('foo',))\n")
Difference: Expected:
MatchesException(Exception('foo',))
Got:
MatchesException(<exceptions.Exception instance at 0xb7385e6c>)
------------
======================================================================
FAIL: testtools.tests.test_matchers.TestMatchesExceptionInstanceInterface.test_describe_difference
----------------------------------------------------------------------
Text attachment: traceback
------------
Traceback (most recent call last):
File "/home/jml/src/testtools/testtools/runtest.py", line 169, in _run_user
return fn(*args, **kwargs)
File "/home/jml/src/testtools/testtools/testcase.py", line 498, in _run_test_method
return self._get_test_method()()
File "/home/jml/src/testtools/testtools/tests/test_matchers.py", line 75, in test_describe_difference
self.assertEqual(difference, mismatch.describe())
File "/home/jml/src/testtools/testtools/testcase.py", line 268, in assertEqual
self.assertThat(observed, matcher)
File "/home/jml/src/testtools/testtools/testcase.py", line 343, in assertThat
self.fail('Match failed. Matchee: "%s"\nMatcher: %s\nDifference: %s\n'
AssertionError: Match failed. Matchee: "<class exceptions.Exception at 0xb751329c> is not a <type 'instance'>"
Matcher: Equals("<type 'exceptions.Exception'> is not a <type 'exceptions.ValueError'>")
Difference: !=:
reference = "<type 'exceptions.Exception'> is not a <type 'exceptions.ValueError'>"
actual = "<class exceptions.Exception at 0xb751329c> is not a <type 'instance'>"
------------
======================================================================
FAIL: testtools.tests.test_matchers.TestMatchesExceptionInstanceInterface.test_matches_match
----------------------------------------------------------------------
Text attachment: traceback
------------
Traceback (most recent call last):
File "/home/jml/src/testtools/testtools/runtest.py", line 169, in _run_user
return fn(*args, **kwargs)
File "/home/jml/src/testtools/testtools/testcase.py", line 498, in _run_test_method
return self._get_test_method()()
File "/home/jml/src/testtools/testtools/tests/test_matchers.py", line 58, in test_matches_match
self.assertEqual(None, matcher.match(candidate))
File "/home/jml/src/testtools/testtools/testcase.py", line 268, in assertEqual
self.assertThat(observed, matcher)
File "/home/jml/src/testtools/testtools/testcase.py", line 343, in assertThat
self.fail('Match failed. Matchee: "%s"\nMatcher: %s\nDifference: %s\n'
AssertionError: Match failed. Matchee: "<testtools.matchers.Mismatch object at -48c62d74 attributes={'_details': {}, '_description': "<class exceptions.ValueError at 0xb7513b3c> is not a <type 'instance'>"}>"
Matcher: Equals(None)
Difference: !=:
reference = None
actual = <testtools.matchers.Mismatch object at -48c62d74 attributes={'_details': {}, '_description': "<class exceptions.ValueError at 0xb7513b3c> is not a <type 'instance'>"}>
------------
======================================================================
FAIL: testtools.tests.test_matchers.TestMatchesExceptionTypeInterface.test__str__
----------------------------------------------------------------------
Text attachment: traceback
------------
Traceback (most recent call last):
File "/home/jml/src/testtools/testtools/runtest.py", line 169, in _run_user
return fn(*args, **kwargs)
File "/home/jml/src/testtools/testtools/testcase.py", line 498, in _run_test_method
return self._get_test_method()()
File "/home/jml/src/testtools/testtools/tests/test_matchers.py", line 68, in test__str__
self.assertThat(matcher, DocTestMatches(expected))
File "/home/jml/src/testtools/testtools/testcase.py", line 343, in assertThat
self.fail('Match failed. Matchee: "%s"\nMatcher: %s\nDifference: %s\n'
AssertionError: Match failed. Matchee: "MatchesException(<class exceptions.Exception at 0xb751329c>)"
Matcher: DocTestMatches("MatchesException(<type 'exceptions.Exception'>)\n")
Difference: Expected:
MatchesException(<type 'exceptions.Exception'>)
Got:
MatchesException(<class exceptions.Exception at 0xb751329c>)
------------
======================================================================
FAIL: testtools.tests.test_matchers.TestMatchesExceptionTypeInterface.test_describe_difference
----------------------------------------------------------------------
Text attachment: traceback
------------
Traceback (most recent call last):
File "/home/jml/src/testtools/testtools/runtest.py", line 169, in _run_user
return fn(*args, **kwargs)
File "/home/jml/src/testtools/testtools/testcase.py", line 498, in _run_test_method
return self._get_test_method()()
File "/home/jml/src/testtools/testtools/tests/test_matchers.py", line 75, in test_describe_difference
self.assertEqual(difference, mismatch.describe())
File "/home/jml/src/testtools/testtools/testcase.py", line 268, in assertEqual
self.assertThat(observed, matcher)
File "/home/jml/src/testtools/testtools/testcase.py", line 343, in assertThat
self.fail('Match failed. Matchee: "%s"\nMatcher: %s\nDifference: %s\n'
AssertionError: Match failed. Matchee: "<class exceptions.Exception at 0xb751329c> is not a <type 'classobj'>"
Matcher: Equals("<type 'exceptions.Exception'> is not a <type 'exceptions.ValueError'>")
Difference: !=:
reference = "<type 'exceptions.Exception'> is not a <type 'exceptions.ValueError'>"
actual = "<class exceptions.Exception at 0xb751329c> is not a <type 'classobj'>"
------------
======================================================================
FAIL: testtools.tests.test_matchers.TestMatchesExceptionTypeInterface.test_matches_match
----------------------------------------------------------------------
Text attachment: traceback
------------
Traceback (most recent call last):
File "/home/jml/src/testtools/testtools/runtest.py", line 169, in _run_user
return fn(*args, **kwargs)
File "/home/jml/src/testtools/testtools/testcase.py", line 498, in _run_test_method
return self._get_test_method()()
File "/home/jml/src/testtools/testtools/tests/test_matchers.py", line 58, in test_matches_match
self.assertEqual(None, matcher.match(candidate))
File "/home/jml/src/testtools/testtools/testcase.py", line 268, in assertEqual
self.assertThat(observed, matcher)
File "/home/jml/src/testtools/testtools/testcase.py", line 343, in assertThat
self.fail('Match failed. Matchee: "%s"\nMatcher: %s\nDifference: %s\n'
AssertionError: Match failed. Matchee: "<testtools.matchers.Mismatch object at -48c62434 attributes={'_details': {}, '_description': "<class exceptions.ValueError at 0xb7513b3c> is not a <type 'classobj'>"}>"
Matcher: Equals(None)
Difference: !=:
reference = None
actual = <testtools.matchers.Mismatch object at -48c62434 attributes={'_details': {}, '_description': "<class exceptions.ValueError at 0xb7513b3c> is not a <type 'classobj'>"}>
------------
======================================================================
FAIL: testtools.tests.test_matchers.TestMismatch.test_constructor_no_arguments
----------------------------------------------------------------------
Text attachment: traceback
------------
Traceback (most recent call last):
File "/home/jml/src/testtools/testtools/runtest.py", line 169, in _run_user
return fn(*args, **kwargs)
File "/home/jml/src/testtools/testtools/testcase.py", line 498, in _run_test_method
return self._get_test_method()()
File "/home/jml/src/testtools/testtools/tests/test_matchers.py", line 47, in test_constructor_no_arguments
Raises(MatchesException(NotImplementedError)))
File "/home/jml/src/testtools/testtools/testcase.py", line 343, in assertThat
self.fail('Match failed. Matchee: "%s"\nMatcher: %s\nDifference: %s\n'
AssertionError: Match failed. Matchee: "<bound method Mismatch.describe of <testtools.matchers.Mismatch object at -48c624f4 attributes={'_details': {}}>>"
Matcher: Raises()
Difference: <class exceptions.NotImplementedError at 0xb75135fc> is not a <type 'classobj'>
------------
======================================================================
FAIL: testtools.tests.test_matchers.TestRaisesBaseTypes.test_KeyboardInterrupt_match_Exception_propogates
----------------------------------------------------------------------
Text attachment: traceback
------------
Traceback (most recent call last):
File "/home/jml/src/testtools/testtools/runtest.py", line 169, in _run_user
return fn(*args, **kwargs)
File "/home/jml/src/testtools/testtools/testcase.py", line 498, in _run_test_method
return self._get_test_method()()
File "/home/jml/src/testtools/testtools/tests/test_matchers.py", line 369, in test_KeyboardInterrupt_match_Exception_propogates
self.assertThat(raise_keyb_from_match, match_keyb)
File "/home/jml/src/testtools/testtools/testcase.py", line 343, in assertThat
self.fail('Match failed. Matchee: "%s"\nMatcher: %s\nDifference: %s\n'
AssertionError: Match failed. Matchee: "<function raise_keyb_from_match at 0xb73aca74>"
Matcher: Raises()
Difference: <function raise_keyb_from_match at 0xb73aca74> returned None
------------
======================================================================
FAIL: testtools.tests.test_matchers.TestRaisesBaseTypes.test_KeyboardInterrupt_matched
----------------------------------------------------------------------
Text attachment: traceback
------------
Traceback (most recent call last):
File "/home/jml/src/testtools/testtools/runtest.py", line 169, in _run_user
return fn(*args, **kwargs)
File "/home/jml/src/testtools/testtools/testcase.py", line 498, in _run_test_method
return self._get_test_method()()
File "/home/jml/src/testtools/testtools/tests/test_matchers.py", line 352, in test_KeyboardInterrupt_matched
self.assertThat(self.raiser, matcher)
File "/home/jml/src/testtools/testtools/testcase.py", line 343, in assertThat
self.fail('Match failed. Matchee: "%s"\nMatcher: %s\nDifference: %s\n'
AssertionError: Match failed. Matchee: "<bound method TestRaisesBaseTypes.raiser of <testtools.tests.test_matchers.TestRaisesBaseTypes.test_KeyboardInterrupt_matched id=0x-48c68734>>"
Matcher: Raises()
Difference: <class exceptions.KeyboardInterrupt at 0xb75133bc> is not a <type 'classobj'>
------------
======================================================================
FAIL: testtools.tests.test_matchers.TestRaisesBaseTypes.test_KeyboardInterrupt_propogates
----------------------------------------------------------------------
Text attachment: traceback
------------
Traceback (most recent call last):
File "/home/jml/src/testtools/testtools/runtest.py", line 169, in _run_user
return fn(*args, **kwargs)
File "/home/jml/src/testtools/testtools/testcase.py", line 498, in _run_test_method
return self._get_test_method()()
File "/home/jml/src/testtools/testtools/tests/test_matchers.py", line 360, in test_KeyboardInterrupt_propogates
self.assertThat(raise_keyb_from_match, match_keyb)
File "/home/jml/src/testtools/testtools/testcase.py", line 343, in assertThat
self.fail('Match failed. Matchee: "%s"\nMatcher: %s\nDifference: %s\n'
AssertionError: Match failed. Matchee: "<function raise_keyb_from_match at 0xb73acb1c>"
Matcher: Raises()
Difference: <function raise_keyb_from_match at 0xb73acb1c> returned None
------------
======================================================================
FAIL: testtools.tests.test_matchers.TestRaisesConvenience.test_exc_type
----------------------------------------------------------------------
Text attachment: traceback
------------
Traceback (most recent call last):
File "/home/jml/src/testtools/testtools/runtest.py", line 169, in _run_user
return fn(*args, **kwargs)
File "/home/jml/src/testtools/testtools/testcase.py", line 498, in _run_test_method
return self._get_test_method()()
File "/home/jml/src/testtools/testtools/tests/test_matchers.py", line 375, in test_exc_type
self.assertThat(lambda: 1/0, raises(ZeroDivisionError))
File "/home/jml/src/testtools/testtools/testcase.py", line 343, in assertThat
self.fail('Match failed. Matchee: "%s"\nMatcher: %s\nDifference: %s\n'
AssertionError: Match failed. Matchee: "<function <lambda> at 0xb73acb8c>"
Matcher: Raises()
Difference: <class exceptions.ZeroDivisionError at 0xb7513a4c> is not a <type 'classobj'>
------------
======================================================================
FAIL: testtools.tests.test_matchers.TestRaisesConvenience.test_exc_value
----------------------------------------------------------------------
Text attachment: traceback
------------
Traceback (most recent call last):
File "/home/jml/src/testtools/testtools/runtest.py", line 169, in _run_user
return fn(*args, **kwargs)
File "/home/jml/src/testtools/testtools/testcase.py", line 498, in _run_test_method
return self._get_test_method()()
File "/home/jml/src/testtools/testtools/tests/test_matchers.py", line 381, in test_exc_value
self.assertThat(raiser, raises(e))
File "/home/jml/src/testtools/testtools/testcase.py", line 343, in assertThat
self.fail('Match failed. Matchee: "%s"\nMatcher: %s\nDifference: %s\n'
AssertionError: Match failed. Matchee: "<function raiser at 0xb73acbfc>"
Matcher: Raises()
Difference: <class exceptions.RuntimeError at 0xb751359c> is not a <type 'instance'>
------------
======================================================================
FAIL: testtools.tests.test_matchers.TestRaisesExceptionMatcherInterface.test_matches_match
----------------------------------------------------------------------
Text attachment: traceback
------------
Traceback (most recent call last):
File "/home/jml/src/testtools/testtools/runtest.py", line 169, in _run_user
return fn(*args, **kwargs)
File "/home/jml/src/testtools/testtools/testcase.py", line 498, in _run_test_method
return self._get_test_method()()
File "/home/jml/src/testtools/testtools/tests/test_matchers.py", line 58, in test_matches_match
self.assertEqual(None, matcher.match(candidate))
File "/home/jml/src/testtools/testtools/testcase.py", line 268, in assertEqual
self.assertThat(observed, matcher)
File "/home/jml/src/testtools/testtools/testcase.py", line 343, in assertThat
self.fail('Match failed. Matchee: "%s"\nMatcher: %s\nDifference: %s\n'
AssertionError: Match failed. Matchee: "<testtools.matchers.Mismatch object at -48d2a2f4 attributes={'_details': {}, '_description': "<class exceptions.Exception at 0xb751329c> is not a <type 'instance'>"}>"
Matcher: Equals(None)
Difference: !=:
reference = None
actual = <testtools.matchers.Mismatch object at -48d2a2f4 attributes={'_details': {}, '_description': "<class exceptions.Exception at 0xb751329c> is not a <type 'instance'>"}>
------------
Ran 77 tests in 0.009s
FAILED (failures=13)
References