Go to main content

man pages section 1: User Commands

Exit Print View

Updated: Wednesday, February 10, 2021
 
 

pytest (1)

Name

pytest - run python unit tests

Synopsis

usage: pytest [OPTIONS] [testfile [testpattern]]

examples:

pytest  path/to/mytests.py  pytest path/to/mytests.py TheseTests pytest
path/to/mytests.py TheseTests.test_thisone

pytest  one  (will  run  both  test_thisone  and  test_thatone)  pytest
path/to/mytests.py -s not (will skip test_notthisone)

pytest --coverage test_foo.py

(only if logilab.devtools is available)

options:
-h, --help
show this help message and exit

-t TESTDIR
directory where the tests will be found

-d     enable design-by-contract

-v, --verbose
Verbose output

-i, --pdb
Enable test failure inspection (conflicts with --coverage)

-x, --exitfirst
Exit  on first failure (only make sense when pytest run one test
file)

-s SKIPPED, --skip=SKIPPED
test names matching this name will be skipped  to  skip  several
patterns, use commas

-q, --quiet
Minimal output

-P PROFILE, --profile=PROFILE
Profile execution and store data in the given file

--coverage
run tests with pycoverage (conflicts with --pdb)

Description

pytest(1)                   General Commands Manual                  pytest(1)



NAME
       pytest - run python unit tests


SYNOPSIS
       usage: pytest [OPTIONS] [testfile [testpattern]]

       examples:

       pytest  path/to/mytests.py  pytest path/to/mytests.py TheseTests pytest
       path/to/mytests.py TheseTests.test_thisone

       pytest  one  (will  run  both  test_thisone  and  test_thatone)  pytest
       path/to/mytests.py -s not (will skip test_notthisone)

       pytest --coverage test_foo.py

              (only if logilab.devtools is available)

   options:
       -h, --help
              show this help message and exit

       -t TESTDIR
              directory where the tests will be found

       -d     enable design-by-contract

       -v, --verbose
              Verbose output

       -i, --pdb
              Enable test failure inspection (conflicts with --coverage)

       -x, --exitfirst
              Exit  on first failure (only make sense when pytest run one test
              file)

       -s SKIPPED, --skip=SKIPPED
              test names matching this name will be skipped  to  skip  several
              patterns, use commas

       -q, --quiet
              Minimal output

       -P PROFILE, --profile=PROFILE
              Profile execution and store data in the given file

       --coverage
              run tests with pycoverage (conflicts with --pdb)



ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       +---------------+-------------------------------+
       |ATTRIBUTE TYPE |       ATTRIBUTE VALUE         |
       +---------------+-------------------------------+
       |Availability   | library/python/logilab-common |
       +---------------+-------------------------------+
       |Stability      | Uncommitted                   |
       +---------------+-------------------------------+
NOTES
       This     software     was    built    from    source    available    at
       https://github.com/oracle/solaris-userland.   The  original   community
       source was downloaded from  pypi:///logilab-common==1.2.2

       Further information about this software can be found on the open source
       community website at http://www.logilab.org/project/logilab-common/.



pytest                           January 2008                        pytest(1)