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

Bug #1467558 reported by James Page
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
testtools
Triaged
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.

Revision history for this message
James Page (james-page) wrote :

For reference, these tests passed OK with:

testtools: 0.9.39
unittest2: 0.5.1

Revision history for this message
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.

Revision history for this message
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
Revision history for this message
Sorin Sbarnea (ssbarnea) wrote :

Also this fails when using skip at class level, something that works with unittests module.

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.