Skip to content

Latest commit

 

History

History
47 lines (38 loc) · 1.06 KB

README.md

File metadata and controls

47 lines (38 loc) · 1.06 KB

pytest

Installation

$ pip install pytest
$ pytest --version   # shows where pytest was imported from
$ pytest --fixtures  # show available builtin function arguments
$ pytest -h | --help # show help on command line and config file options

Usage

If you want to know the default options, see pytest.ini

  • Run all tests:
    $ pytest
  • Specifying tests / selecting tests:
    # Run tests in a module
    $ pytest test_mod.py
    # Run tests in a directory
    $ pytest testing/
  • Profiling test execution duration
    $ pytest --durations=10
  • Stopping after the first (or N) failures:
    # stop after first failure
    $ pytest -x
    # stop after two failures
    $ pytest --maxfail=2

Create All test programs

Detect program files which don't have test programs (test_....py) in this directory.

$ python _generate_all_templates.py