testtools.skip decorator not functional with unittest.TestCase as base class

Bug #1467558 reported by James Page on 2015-06-22
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
testtools
Medium
Unassigned

Bug Description

This may or may not be a bug, but its certainly a change in behaviour between versions of testtools/unittest2.

testtools: 1.4.0
unittest2: 0.8.0

Inheritance chain: AppsTest -> ScopeHarnessTestCase -> unittest.TestCase

AppsTest uses the skip decorator:

class AppsTest (ScopeHarnessTestCase):

    @testtools.skip('No fake local data available.')
    def setUp(self):
        super().setUp()

Results in an ERROR:

======================================================================
ERROR: tests.test_apps.AppsTest.test_department_browsing
----------------------------------------------------------------------
Traceback (most recent call last):
unittest2.case.SkipTest: No fake local data available.

switching the base class to testtools.TestCase resolves the problem, and looks more consistent.

James Page (james-page) wrote :

For reference, these tests passed OK with:

testtools: 0.9.39
unittest2: 0.5.1

dobey (dobey) wrote :

This seems to only be an issue when the skip is a decorator on the setUp() method. Having it be a decorator on individual tests seems to work fine.

Jonathan Lange (jml) wrote :

Minimal example:

import unittest
from testtools import skip

class FooTests(unittest.TestCase):
    @skip('Ha!')
    def setUp(self):
        pass

    def test_foo(self):
        pass

unittest.main()

Can confirm is still a problem in master.

Changed in testtools:
status: New → Triaged
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers