talira

pytest: helps you write better programs

open sourceMITself-hostablefree

pytest is the test framework for Python that makes small, readable tests easy and scales to complex functional testing of applications and libraries. Tests are plain functions using the plain assert statement, and pytest reports detailed information about failing assertions. It discovers test modules and functions automatically, manages test resources through modular fixtures, parametrizes tests and fixtures, and runs existing unittest suites out of the box. More than 1,300 external plugins extend it. It runs on Python 3.10+ and PyPy 3, is MIT licensed and is funded through donations on Open Collective.

Problems it solves

  • write Python tests with plain assert statements instead of self.assertEqual everywhere
  • share database and API test setup across many tests without copying code
  • run the same test against a list of different inputs
  • see exactly which values differed when an assertion fails
  • run our old unittest suite and new-style tests together
  • rerun only the tests that failed last time
  • skip tests on platforms where they can't pass and mark known failures

Features

  • plain assert statements with detailed failure reports
  • automatic discovery of test modules and functions
  • modular fixtures for test resources
  • parametrized tests and fixtures
  • runs unittest and trial suites out of the box
  • 1,300+ external plugins
  • rerun failed tests and keep state between runs

Capabilities

Has a command line toolplan not known
Takes pluginsplan not known
Has official SDKsplan not known

Alternatives

The same job

These do what pytest does.

  1. RSpec Behaviour-driven testing framework for Ruby
  2. Jest Delightful JavaScript Testing
  3. Vitest Next generation testing framework powered by Vite

Compare pytest with the top 3