On this page
unittest.skip
Prev: unittest.removeResult | Up: unittest | Next: unittest.skipIf
Rel: unittest.addModuleCleanup, unittest.doModuleCleanups, unittest.enterModuleContext, unittest.expectedFailure
Ref: docs.python.org — unittest.skip
Tags: #public #python3 #stdlib #unittest
Import
import unittest
from unittest import skip
Signature & Overview
unittest.skip(reason)
Unconditionally skip a test.
Usage
import unittest
class Demo(unittest.TestCase):
@unittest.skip("not implemented yet")
def test_future(self) -> None:
self.fail("should not run")
res = unittest.TestResult()
Demo("test_future").run(res)
assert len(res.skipped) == 1
Gotchas
- Works on both test methods and entire
TestCaseclasses:setUp()andtearDown()are not executed for skipped tests.
REPL Inspect
from unittest import skip
help(skip)
Linked from
Related notes
- tuts/python3/stdlib_module/unittest/removeResult Linked here; links to this page; shared tags: #stdlib, #unittest
- tuts/python3/stdlib_module/unittest/skipIf Linked here; links to this page; shared tags: #stdlib, #unittest
- tuts/python3/stdlib_module/unittest Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/unittest/addModuleCleanup Linked here; shared tags: #stdlib, #unittest
- tuts/python3/stdlib_module/unittest/doModuleCleanups Linked here; shared tags: #stdlib, #unittest
- tuts/python3/stdlib_module/unittest/enterModuleContext Linked here; shared tags: #stdlib, #unittest
- tuts/python3/stdlib_module/unittest/expectedFailure Linked here; shared tags: #stdlib, #unittest
- tuts/python3/stdlib_module/unittest/FunctionTestCase shared tags: #stdlib, #unittest
- tuts/python3/stdlib_module/unittest/installHandler shared tags: #stdlib, #unittest
- tuts/python3/stdlib_module/unittest/IsolatedAsyncioTestCase shared tags: #stdlib, #unittest