Open Bug 1432456 Opened 4 years ago Updated 4 years ago

Custom Marionette harness skip decorators shouldn't trigger setUp() and tearDown() for skipped tests


(Testing :: Marionette, defect, P5)

Version 3


(Not tracked)


(Reporter: whimboo, Unassigned)



As noticed while working on bug 1429759, the custom skip decorators in [1] do not stop the test runner from executing `setUp()` and `tearDown()`. As result inappropriate code is getting executed, which basically shouldn't be run at all (eg. restarts of Firefox).


    def setUp(self):
        print "*** running setUp"

    def tearDown(self):
        print "** running tearDown"

    @skip_if_desktop("don't run!")
    def test(self):
        print "** test"

> TEST-START | _a/ TestMinimizedTestCase.test
> *** running setUp
> TEST-SKIP | _a/ TestMinimizedTestCase.test | took 136ms
> ** running tearDown

In contrast the `skip` decorator works just fine.

> TEST-START | _a/ TestMinimizedTestCase.test
> TEST-SKIP | _a/ TestMinimizedTestCase.test | took 1ms

Ok, so there is actually no way around that without messing up with the testcase classes in the harness.

Given that we have code to run in the custom skip decorators which need access to an existing Marionette instance, we clearly have to run the setUp() method of the MarionetteTestCase class. And as such we also run the setUp method of the testcase class.

We could think about to move the instance creation already to the setUpClass() method, but not sure which implications it would have without digging too much into this problem.

For now we should make sure that setUp methods don't run code which should be avoided in case of the custom skip decorator declares the method to be skipped.
I’m inclined to say we should not fix this bug and instead focus
future efforts on porting the entire test suite to pytest.  I think
that would be a vastly better use of our time than hacking on
OS: Unspecified → All
Priority: -- → P4
Hardware: Unspecified → All
Priority: P4 → P5
You need to log in before you can comment on or make changes to this bug.