OptionsOn pytest itself
--assert
Control assertion debugging tools. 'plain' performs no assertion debugging. 'rewrite' (the default) rewrites assert statements in test modules on import to provide assert expression information <Mode>
--basetemp
Base temporary directory for this test run.(warning: this directory is removed if it exists) <Directory>
-c
Load configuration from `file` instead of trying to locate one of the implicit configuration files <File>
--cache-clear
Remove all cache contents at start of test run
--cache-show
Show cache contents, don't perform collection or tests. Optional argument: glob (default: '*') <Glob>
--capture
Per-test capturing method <Method>
--code-highlight
Whether code should be highlighted (only if --color is also enabled) <Highlight>
--co--collect-only
Only collect tests, don't execute them
--collect-in-virtualenv
Don't ignore tests in a local virtualenv directory
--color
Color terminal output <Color>
--confcutdir
Only load conftest.py's relative to specified dir <Dir>
--continue-on-collection-errors
Force test execution even if collection errors occur
--debug
Store internal tracing debug information in this log file. This file is opened with 'w' and truncated as a result, care advised. Defaults to 'pytestdebug.log' <Debug File Name>
--durations
Show N slowest setup/test durations (N=0 for all) <N>
--durations-min
Minimal duration in seconds for inclusion in slowest list <N>
--deselect
Deselect item (via node id prefix) during collection (multi-allowed) <nodeid_prefix>
--disable-warnings--disable-pytest-warnings
Disable warnings summary
--doctest-continue-on-failure
For a given doctest, continue to run after the first failure
--doctest-ignore-import-errors
Ignore doctest ImportErrors
--doctest-modules
Run doctests in all .py modules
--doctest-report
Choose another output format for diffs on doctest failure <Output format>
--doctest-glob
Doctests file matching pattern, default: test*.txt <Pattern>
--exitfirst-x
Exit instantly on first error or failed test
--failed-first--ff
Run all tests, but run the last failures first
--fixtures
Shows builtin and custom fixtures. Note that this command omits fixtures with leading _ unless the -v option is added
--fixtures-per-test
Show fixtures per test
--full-trace
Don't cut any tracebacks (default is to cut)
--help-h
This shows help on command line and config-line options
--ignore
Ignore path during collection (multi-allowed) <Path>
--ignore-glob
Ignore path pattern during collection (multi-allowed) <Path>
--import-mode
Prepend/append to sys.path when importing test modules and conftest files, default is to prepend <Mode>
--junit-xml
Create junit-xml style report file at given path <Path>
--junit-prefix
Prepend prefix to classnames in junit-xml output <Str>
-k
Only run tests which match the given substring expression. An expression is a python evaluatable expression where all names are substring-matched against test names and their parent classes. Example: -k 'test_method or test_other' matches all test functions and classes whose name contains 'test_method' or 'test_other', while -k 'not test_method' matches those that don't contain 'test_method' in their names. -k 'not test_method and not test_other' will eliminate the matches. Additionally keywords are matched to classes and functions containing extra names in their 'extra_keyword_matches' set, as well as functions which have names assigned directly to them. The matching is case- insensitive <Expression>
--keep-duplicates
Keep duplicate tests
--showlocals-l
Show locals in tracebacks (disabled by default)
--last-failed-no-failures--lfnf
Which tests to run with no previously (known) failures <Tests>
--last-failed--lf
Rerun only the tests that failed at the last run (or all if none failed)
--log-auto-indent
Auto-indent multiline messages passed to the logging module. Accepts true|on, false|off or an integer <Log Auto Indent Setting>
--log-cli-level
Cli logging level <Log CLI Level>
--log-cli-format
Log format as used by the logging module <Log CLI Format>
--log-cli-date-format
Log date format as used by the logging module <Log CLI Date Format>
--log-date-format
Log date format as used by the logging module <Log Date Format>
--log-format
Log format as used by the logging module <Log Format>
--log-file
Path to a file where logging will be written to <Log File Path>
--log-file-level
Log file logging level <Log File Level>
--log-file-date-format
Log date format as used by the logging module <Log File Date Format>
--log-file-format
Log format as used by the logging module <Log File Format>
--log-level
Level of messages to catch/display. Not set by default, so it depends on the root/parent log handler's effective level, where it is `WARNING` by default <Level>
-m
Only run tests matching given mark expression <Mark Expression>
--markers
Show markers (builtin, plugin and per-project ones)
--maxfail
Exit after first num failures or errors <num>
--new-first--nf
Run tests from new files first, then the rest of the tests sorted by file mtime
--noconftest
Don't load any conftest.py files
--no-header
Disable header
--no-summary
Disable summary
--override-ini-o
Override ini option with `option=value` style` <Override INI>
-p
Early-load given plugin module name or entry point (multi-allowed) <Plugin name>
--pastebin
Send failed|all info to bpaste.net pastebin service <mode>
--pdb
Start the interactive Python debugger on errors or KeyboardInterrupt
--pdbcls
Specify a custom interactive Python debugger for use with --pdb <modulename:classname>
--pyargs
Try to interpret all arguments as python packages
--quiet-q
Decrease verbosity
-r
Show extra test summary info as specified by chars: (f)ailed, (E)rror, (s)kipped, (x)failed, (X)passed, (p)assed, (P)assed with output, (a)ll except passed (p/P), or (A)ll. (w)arnings are enabled by default (see --disable-warnings), 'N' can be used to reset the list. (default: 'fE') <chars>
--rootdir
Define root directory for tests. Can be relative path: 'root_dir', './root_dir', 'root_dir/another_dir/'; absolute path: '/home/user/root_dir'; path with variables:'$HOME/root_dir' <Root Dir>
--runxfail
Report the results of xfail tests as if they were not marked
-s
Shortcut for --capture=no
--setup-only
Only setup fixtures, do not execute tests
--setup-show
Show setup of fixtures while executing tests
--setup-plan
Show what fixtures and tests would be executed but don't execute anything
--show-capture
Controls how captured stdout/stderr/log is shown on failed tests <Capture method>
--stepwise--sw
Exit on test failure and continue from last failing test next time
--stepwise-skip--sw-skip
Ignore the first failing test but stop on the next failing test
--strict
Alias to --strict-markers
--strict-config
Any warnings encountered while parsing the `pytest` section of the configuration file raise errors
--strict-markers
Markers not registered in the `markers` section of the configuration file raise errors
--tb
Traceback print mode <Traceback print mode>
--trace
Immediately break when running each test
--trace-config
Trace considerations of conftest.py files
--verbose-v
Increase verbosity
--verbosity
Set verbosity. Default is 0 <Verbosity level>
--version-V
Display pytest version and information about plugins. When given twice, also display information about plugins
--pythonwarnings-W
Set which warnings to report, see -W option of python itself <Warnings to report>