Opened 9 years ago

Closed 9 years ago

#5863 defect closed invalid (invalid)

t.test.test_rebuild.NewStyleTestCase incorrectly skipped and failing for Python >= 2.6

Reported by: Thijs Triemstra Owned by:
Priority: low Milestone:
Component: core Keywords:
Cc: Thijs Triemstra Branch:
Author:

Description

twisted.test.test_rebuild.NewStyleTestCase.test_errorSlots is skipped with the following message when running with Python 2.7:

[SKIPPED]
__class__ assignment for class with slots should work starting Python 2.6

The message indicates this test should work on Python 2.6 or newer. Since this is displayed with Python 2.7 the skip-test check is incorrect. This patch fixes that:

  • twisted/test/test_rebuild.py

     
    192192        self.assertEqual(inst.a, 7)
    193193        self.assertIdentical(type(inst), self.m.SlottedClass)
    194194
    195     if sys.version_info < (2, 6):
     195    if sys.version_info[:2] < (2, 6):
    196196        test_slots.skip = "__class__ assignment for class with slots is only available starting Python 2.6"
    197197
    198198
     
    210210        exec classDefinition in self.m.__dict__
    211211        self.assertRaises(rebuild.RebuildError, rebuild.updateInstance, inst)
    212212
    213     if sys.version_info >= (2, 6):
     213    if sys.version_info[:2] < (2, 6):
    214214        test_errorSlots.skip = "__class__ assignment for class with slots should work starting Python 2.6"

But this results in a failing test:

[FAIL]
Traceback (most recent call last):
  File "/home/thijs/workspaces/opensource/Twisted/trunk/twisted/test/test_rebuild.py", line 211, in test_errorSlots
    self.assertRaises(rebuild.RebuildError, rebuild.updateInstance, inst)
twisted.trial.unittest.FailTest: RebuildError not raised (None returned)

twisted.test.test_rebuild.NewStyleTestCase.test_errorSlots

Since we dropped support for Python 2.5 the test shouldn't be skipped anymore (and fixed or marked todo).

Change History (1)

comment:1 Changed 9 years ago by Jean-Paul Calderone

Resolution: invalid
Status: newclosed

The skipped test is for the error behavior in Python 2.5 and earlier. We could delete it and the supporting code now, but the skip and test test are both correct.

It fails on Python 2.6 and Python 2.7 because twisted.python.rebuild doesn't fail on those versions for this case.

Note: See TracTickets for help on using tickets.