Test failures with Python 2.6

Bug #987490 reported by Arfrever Frehtes Taifersar Arahesis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
subunit
Fix Released
Critical
Arfrever Frehtes Taifersar Arahesis

Bug Description

$ python2.6 -m testtools.run subunit.test_suite
Tests running...
======================================================================
ERROR: subunit.tests.test_subunit_filter.TestTestResultFilter.test_fixup_expected_errors
----------------------------------------------------------------------
Traceback (most recent call last):
  File "subunit/tests/test_subunit_filter.py", line 107, in test_fixup_expected_errors
    [failure[0].id() for failure in filtered_result.expectedFailures])
AttributeError: 'TestResult' object has no attribute 'expectedFailures'
======================================================================
ERROR: subunit.tests.test_subunit_filter.TestTestResultFilter.test_fixup_expected_failures
----------------------------------------------------------------------
Traceback (most recent call last):
  File "subunit/tests/test_subunit_filter.py", line 97, in test_fixup_expected_failures
    [failure[0].id() for failure in filtered_result.expectedFailures])
AttributeError: 'TestResult' object has no attribute 'expectedFailures'
======================================================================
ERROR: subunit.tests.test_subunit_filter.TestTestResultFilter.test_fixup_unexpected_success
----------------------------------------------------------------------
Traceback (most recent call last):
  File "subunit/tests/test_subunit_filter.py", line 117, in test_fixup_unexpected_success
    [passed.id() for passed in filtered_result.unexpectedSuccesses])
AttributeError: 'TestResult' object has no attribute 'unexpectedSuccesses'

Ran 247 tests in 0.244s
FAILED (failures=3)

I'm attaching the patch.

Revision history for this message
Arfrever Frehtes Taifersar Arahesis (arfrever-fta) wrote :
Revision history for this message
Robert Collins (lifeless) wrote :

Thanks for the patch. As we depend on testtools we can use its support for those API calls rather than removing the tests entirely.

Revision history for this message
Robert Collins (lifeless) wrote :

And, TestResultDecorator now includes an ExtendedToOriginalDecorator call, TestResultFilter subclasses TestResultDecorator, so AFAICT, this should be fixed in trunk. I realise you filed the bug only recently, but this was changed only recently :(.

Could you please retry with trunk, or with 0.0.8 once I release it? If its still a problem, I'll be delighted to do a 0.0.9 fixing the issue.

Changed in subunit:
status: New → Incomplete
Revision history for this message
Arfrever Frehtes Taifersar Arahesis (arfrever-fta) wrote :

Results for revision 169:

$ python2.6 -m testtools.run subunit.test_suite
Tests running...
======================================================================
ERROR: subunit.tests.test_subunit_filter.TestTestResultFilter.test_fixup_expected_errors
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/subunit/python/subunit/tests/test_subunit_filter.py", line 144, in test_fixup_expected_errors
    [failure[0].id() for failure in filtered_result.expectedFailures])
AttributeError: 'TestResult' object has no attribute 'expectedFailures'
======================================================================
ERROR: subunit.tests.test_subunit_filter.TestTestResultFilter.test_fixup_expected_failures
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/subunit/python/subunit/tests/test_subunit_filter.py", line 134, in test_fixup_expected_failures
    [failure[0].id() for failure in filtered_result.expectedFailures])
AttributeError: 'TestResult' object has no attribute 'expectedFailures'
======================================================================
ERROR: subunit.tests.test_subunit_filter.TestTestResultFilter.test_fixup_unexpected_success
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/subunit/python/subunit/tests/test_subunit_filter.py", line 154, in test_fixup_unexpected_success
    [passed.id() for passed in filtered_result.unexpectedSuccesses])
AttributeError: 'TestResult' object has no attribute 'unexpectedSuccesses'
======================================================================
ERROR: subunit.tests.test_subunit_filter.TestTestResultFilter.test_time_ordering_preserved
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/subunit/python/subunit/tests/test_subunit_filter.py", line 234, in test_time_ordering_preserved
    self.assertSequenceEqual(
AttributeError: 'TestTestResultFilter' object has no attribute 'assertSequenceEqual'
======================================================================
ERROR: subunit.tests.test_subunit_filter.TestTestResultFilter.test_time_passes_through_filtered_tests
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/subunit/python/subunit/tests/test_subunit_filter.py", line 262, in test_time_passes_through_filtered_tests
    self.assertSequenceEqual(
AttributeError: 'TestTestResultFilter' object has no attribute 'assertSequenceEqual'

Ran 256 tests in 0.918s
FAILED (failures=5)

Revision history for this message
Arfrever Frehtes Taifersar Arahesis (arfrever-fta) wrote :

The exceptions are different:

$ python3.1 -c 'open("/dev/null", "w").read()'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
IOError: not readable
$ python3.2 -c 'open("/dev/null", "w").read()'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
io.UnsupportedOperation: not readable

The following fix works, but maybe _UnsupportedOperation should be changed.

--- python/subunit/__init__.py
+++ python/subunit/__init__.py
@@ -1280,7 +1280,7 @@
             # Read streams
             if type(stream.read(0)) is str:
                 return stream.buffer
- except _UnsupportedOperation:
+ except (_UnsupportedOperation, IOError):
             # Cannot read from the stream: try via writes
             try:
                 stream.write(_b(''))

===

Revision history for this message
Arfrever Frehtes Taifersar Arahesis (arfrever-fta) wrote :

The last comment was for bug #987514.

Revision history for this message
Robert Collins (lifeless) wrote :

Ok, I'll have a stab at this, and comment here when I have landed a possible fix. Should be a few minutes.

Revision history for this message
Robert Collins (lifeless) wrote :

ok, the assertSequenceEquals was spurious and unneeded, I've made that assertEqual. The other things are introspecting attributes that only existing in 2.7+. Seeing if there is a workaround now.

Revision history for this message
Robert Collins (lifeless) wrote :

nope, nothing trivial, will take your approach.

Changed in subunit:
status: Incomplete → Fix Released
importance: Undecided → Critical
assignee: nobody → Arfrever Frehtes Taifersar Arahesis (arfrever-fta)
milestone: none → next
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.