O'Reilly logo

Test-Driven Python Development by Siddharta Govindaraj

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Pattern – running a subset of tests

We already saw a simple way of running a subset of tests by simply specifying the module or test class on the command line, as shown in the following:

python -m unittest stock_alerter.tests.test_stock
python -m unittest stock_alerter.tests.test_stock.StockTest

This works for the common case of when we want to run a subset based on the module. What if we want to run tests based on some other parameter? Maybe we want to run a set of basic smoke tests, or we want to run only integration tests, or we want to skip tests when running on a specific platform or Python version.

The unittest module allows us to create test suites. A test suite is a collection of test classes that are run. By default, unittest performs an ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required