◐ Shell
clean mode source ↗

Message 194790 - Python tracker

Some tests in Python testsuite are silently skipped if requirements is not satisfied. The proposed patch adds explicit "skipUnless()" and "raise SkipTest()" so that these tests now reported as skipped.

I.e. the code like

    if not condition:
        def test_foo(self):
            ...

is replaced by

    @unittest.skipUnless(condition, "requires foo")
    def test_foo(self):
        ...

and the code like

    def test_foo(self):
        ...
        if not condition:
            return
        ...

is replaced by

    def test_foo(self):
        ...
        if not condition:
            raise unittest.SkipTest("requires foo")
        ...