Table Of Contents

Previous topic

Overview and Introduction

Next topic

Installation and Getting Started

This Page

py.test Features

no-boilerplate testing with Python

  • automatic, fully customizable Python test discovery
  • write simple test functions and freely group tests
  • assert statement for your assertions
  • powerful parametrization of test functions
  • rely on helpful traceback and failing assertion reporting
  • use print or pdb debugging on failures
  • enables fully PEP 8 compliant coding style

extensive plugin and customization system

  • all collection, reporting, running aspects are delegated to hook functions
  • hook functions are implemented per-directory, per-project or through PyPI released plugins
  • it is easy to add command line options or do other kind of add-ons and customizations.

mature command line testing tool

  • powerful Usage and Invocations possibilities, well sorted command line options
  • used in many projects, ranging from 10 to 10K tests
  • tested on Unix and Windows from Python 2.4 up to Python 3.1 and 3.2
  • keyword/testname based selection of tests

integrates well with CI systems

  • produces compatible JunitXML output for Hudson or other CI servers
  • produces “resultlog” text files for easy parsing
  • integrates well with tox

supports common testing practises and methods

distributing tests to local/remote subprocesses

  • distribute tests to multiple CPUs
  • distribute tests to remote ssh or socket connected machines
  • run tests in subprocess, re-run failing ones on file-change

skip or expect-to-fail a test

  • skip tests if there are platform or dependency mismatches
  • xfail a test (on certain platforms)indicating an implementation problem
  • you can use skip and xfail imperatively or as a decorating marker