Opened 8 years ago

Closed 8 years ago

#27214 closed Cleanup/optimization (fixed)

The skipIfDBFeature decorators and its variants should respect their defined wrapped order and test case inheritance.

Reported by: Simon Charette Owned by: Simon Charette
Component: Testing framework Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The database features test skipping decorators do not respect the order in which they are wrapped or inherited and end up masking the original reason that resulted in skipping the test.

For example given the following test case classes:

@skipIfDbFeature('available')
@skipUnlessDbFeature('missing')
class Foo(TestCase):
   def test_foo(self):
        pass

@skipUnlessDbFeature('also-missing')
class Bar(Foo):
    def test_bar(self):
        pass

The Foo.test_foo method would be skipped with the following reason: 'Database has feature(s) available' and the Bar.test_bar method would be skipped with 'Database doesn't support feature(s): also-missing' when both should be skipped with 'Database doesn't support feature(s): missing'.

This is an issue I discovered while working on 32c0d823e5316aa7d616a69996919b62748368cc where I noticed JSONB tests were skipped with the 'Database doesn't support feature(s): has_jsonb_datatype' instead of the expected 'PostgreSQL specific tests' when running tests using the SQLite backend.

Change History (3)

comment:1 by Simon Charette, 8 years ago

Has patch: set

comment:2 by Tim Graham, 8 years ago

Triage Stage: UnreviewedReady for checkin

comment:3 by Simon Charette <charette.s@…>, 8 years ago

Resolution: fixed
Status: newclosed

In 18c72d59:

Fixed #27214 -- Made skip db features decorators respect wrapping order and inheritance.

Note: See TracTickets for help on using tickets.
Back to Top