autopilot ignores class-level conditional skip() decorator

Bug #1465667 reported by Olivier Tilloy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Autopilot
Confirmed
Medium
Unassigned

Bug Description

The webbrowser_app test suite has a few tests that are conditionally skipped depending on the platform, such as:

    @unittest.skipIf(model() == "Desktop", "on devices only")
    def test_swipe_partway_switches_tabs(self):
        …

This works well for skipping one specific test method, but it doesn’t seem to work for skipping an entire TestCase. We’re adding support for keyboard shortcuts in the browser, which obviously makes sense only on platforms with a physical keyboard, so we would like to skip the entire test case when not on desktop, but it seems the decorator is ignored by autopilot, and it tries to run all the tests:

    @unittest.skipIf(model() != "Desktop", "on desktop only")
    class TestKeyboard(PrepopulatedDatabaseTestCaseBase):
        …

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

This should probably work, but have you tried using testtools.skipIf? This seems to work for me

Changed in autopilot:
status: New → Incomplete
Revision history for this message
Olivier Tilloy (osomon) wrote :

testtools.skipIf() seems to work indeed. Why would unittest.skipIf() not work though?

Changed in autopilot:
status: Incomplete → New
Revision history for this message
Christopher Lee (veebers) wrote :

Confirmed that unittest.skipIf doesn't skip a whole class (testtools does though). Have marked as medium.

Changed in autopilot:
status: New → Confirmed
importance: Undecided → Medium
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.