How to Skip Tests

Let’s learn how we can skip tests using unittest module.

The unittest module supports skipping tests as of Python 3.1. There are a few use cases for skipping tests:

  • You might want to skip a test if the version of a library doesn’t support what you want to test
  • The test is dependent on the operating system it is running under
  • Or you have some other criteria for skipping a test

Let’s change our test case so it has a couple of tests that will be skipped:

Get hands-on with 1400+ tech skills courses.