Pytest executes a subset of the test suite

Pytest Executing a Subset of a Test Suite

In a real-world scenario, we would have multiple test files, each with several tests. The tests would cover various modules and functionality. Suppose, we only want to run a specific set of tests; how do we do that?

Pytest provides two methods for running a subset of a test suite.

  • Selecting tests to run based on a substring match of the test name.
  • Selecting groups of tests to run based on applied tags.

We will explain both of these methods with examples in the following sections.

Leave a Reply

Your email address will not be published. Required fields are marked *