Skip to content

pytest

pytest documentation

footman._stubs.pytest.Pytest

Bases: Tool

__call__

__call__(
    *args: str,
    assert_: _Value = ...,
    basetemp: _Value = ...,
    cache_clear: _Flag = ...,
    cache_show: _Value = ...,
    capture: _Value = ...,
    code_highlight: _Flag = ...,
    collect_in_virtualenv: _Flag = ...,
    collect_only: _Flag = ...,
    color: _Value = ...,
    confcutdir: _Value = ...,
    config_file: _Value = ...,
    continue_on_collection_errors: _Flag = ...,
    cov: _Value = ...,
    cov_append: _Flag = ...,
    cov_branch: _Flag = ...,
    cov_config: _Value = ...,
    cov_context: _Value = ...,
    cov_fail_under: _Value = ...,
    cov_precision: _Value = ...,
    cov_report: _Value = ...,
    cov_reset: _Flag = ...,
    debug: _Value = ...,
    deselect: _Value = ...,
    disable_plugin_autoload: _Flag = ...,
    disable_warnings: _Flag = ...,
    doctest_continue_on_failure: _Flag = ...,
    doctest_glob: _Value = ...,
    doctest_ignore_import_errors: _Flag = ...,
    doctest_modules: _Flag = ...,
    doctest_report: _Flag = ...,
    durations: _Value = ...,
    durations_min: _Value = ...,
    exitfirst: _Flag = ...,
    ff: _Flag = ...,
    fixtures: _Flag = ...,
    fixtures_per_test: _Flag = ...,
    force_short_summary: _Flag = ...,
    full_trace: _Flag = ...,
    ignore: _Value = ...,
    ignore_glob: _Value = ...,
    import_mode: _Flag = ...,
    junitprefix: _Value = ...,
    junitxml: _Value = ...,
    k: _Value = ...,
    keep_duplicates: _Flag = ...,
    lf: _Flag = ...,
    lfnf: _Flag = ...,
    log_auto_indent: _Value = ...,
    log_cli_date_format: _Value = ...,
    log_cli_format: _Value = ...,
    log_cli_level: _Value = ...,
    log_date_format: _Value = ...,
    log_disable: _Value = ...,
    log_file: _Value = ...,
    log_file_date_format: _Value = ...,
    log_file_format: _Value = ...,
    log_file_level: _Value = ...,
    log_file_mode: _Flag = ...,
    log_format: _Value = ...,
    log_level: _Value = ...,
    m: _Value = ...,
    markers: _Flag = ...,
    max_warnings: _Value = ...,
    maxfail: _Value = ...,
    nf: _Flag = ...,
    no_cov: _Flag = ...,
    no_cov_on_fail: _Flag = ...,
    no_fold_skipped: _Flag = ...,
    no_header: _Flag = ...,
    no_summary: _Flag = ...,
    noconftest: _Flag = ...,
    override_ini: _Value = ...,
    p: _Value = ...,
    pastebin: _Value = ...,
    pdb: _Flag = ...,
    pdbcls: _Value = ...,
    pyargs: _Flag = ...,
    pythonwarnings: _Value = ...,
    quiet: _Flag = ...,
    report_chars: _Value = ...,
    rootdir: _Value = ...,
    runxfail: _Flag = ...,
    s: _Flag = ...,
    setup_only: _Flag = ...,
    setup_plan: _Flag = ...,
    setup_show: _Flag = ...,
    show_capture: _Flag = ...,
    showlocals: _Flag = ...,
    strict: _Flag = ...,
    strict_config: _Flag = ...,
    strict_markers: _Flag = ...,
    sw: _Flag = ...,
    sw_reset: _Flag = ...,
    sw_skip: _Flag = ...,
    tb: _Value = ...,
    trace: _Flag = ...,
    trace_config: _Flag = ...,
    verbose: _Flag = ...,
    verbosity: _Value = ...,
    xfail_tb: _Flag = ...,
    **flags: Any,
) -> Result

Run this verb.

Parameters:

Name Type Description Default
assert_ _Value

Control assertion debugging tools.

...
basetemp _Value

Base temporary directory for this test run.

...
cache_clear _Flag

Remove all cache contents at start of test run.

...
cache_show _Value

Show cache contents, don't perform collection or tests. Defaults to *.

...
capture _Value

Per-test capturing method: one of fd|sys|no|tee-sys.

...
code_highlight _Flag

Whether code should be highlighted (only if --color is also enabled).

...
collect_in_virtualenv _Flag

Don't ignore tests in a local virtualenv directory.

...
collect_only _Flag

Only collect tests, don't execute them.

...
color _Value

Color terminal output (yes/no/auto).

...
confcutdir _Value

Only load conftest.py's relative to specified dir.

...
config_file _Value

Load configuration from FILE instead of trying to locate one of the implicit configuration files.

...
continue_on_collection_errors _Flag

Force test execution even if collection errors occur.

...
cov _Value

Path or package name to measure during execution (multi-allowed).

...
cov_append _Flag

Do not delete coverage but append to current.

...
cov_branch _Flag

Enable branch coverage.

...
cov_config _Value

Config file for coverage.

...
cov_context _Value

Dynamic contexts to use.

...
cov_fail_under _Value

Fail if the total coverage is less than MIN.

...
cov_precision _Value

Override the reporting precision.

...
cov_report _Value

Type of report to generate: term, term-missing, annotate, html, xml, json, markdown, markdown-append, lcov (multi-allowed).

...
cov_reset _Flag

Reset cov sources accumulated in options so far.

...
debug _Value

Store internal tracing debug information in this log file.

...
deselect _Value

Deselect item (via node id prefix) during collection (multi-allowed).

...
disable_plugin_autoload _Flag

Disable plugin auto-loading through entry point packaging metadata.

...
disable_warnings _Flag

Disable warnings summary.

...
doctest_continue_on_failure _Flag

For a given doctest, continue to run after the first failure.

...
doctest_glob _Value

Doctests file matching pattern, default: test*.txt.

...
doctest_ignore_import_errors _Flag

Ignore doctest collection errors.

...
doctest_modules _Flag

Run doctests in all .py modules.

...
doctest_report _Flag

Choose another output format for diffs on doctest failure.

...
durations _Value

Show N slowest setup/test durations (N=0 for all).

...
durations_min _Value

Minimal duration in seconds for inclusion in slowest list.

...
exitfirst _Flag

Exit instantly on first error or failed test.

...
ff _Flag

Run all tests, but run the last failures first.

...
fixtures _Flag

Show available fixtures, sorted by plugin appearance (fixtures with leading '_' are only shown with '-v').

...
fixtures_per_test _Flag

Show fixtures per test.

...
force_short_summary _Flag

Force condensed summary output regardless of verbosity level.

...
full_trace _Flag

Don't cut any tracebacks.

...
ignore _Value

Ignore path during collection (multi-allowed).

...
ignore_glob _Value

Ignore path pattern during collection (multi-allowed).

...
import_mode _Flag

Prepend/append to sys.path when importing test modules and conftest files.

...
junitprefix _Value

Prepend prefix to classnames in junit-xml output.

...
junitxml _Value

Create junit-xml style report file at given path.

...
k _Value

Only run tests which match the given substring expression.

...
keep_duplicates _Flag

Keep duplicate tests.

...
lf _Flag

Rerun only the tests that failed at the last run (or all if none failed).

...
lfnf _Flag

With --lf, determines whether to execute tests when there are no previously (known) failures or when no cached lastfailed data was found.

...
log_auto_indent _Value

Auto-indent multiline messages passed to the logging module.

...
log_cli_date_format _Value

Log date format used by the logging module.

...
log_cli_format _Value

Log format used by the logging module.

...
log_cli_level _Value

CLI logging level.

...
log_date_format _Value

Log date format used by the logging module.

...
log_disable _Value

Disable a logger by name. May be repeated: a list emits the flag once per item.

...
log_file _Value

Path to a file when logging will be written to.

...
log_file_date_format _Value

Log date format used by the logging module.

...
log_file_format _Value

Log format used by the logging module.

...
log_file_level _Value

Log file logging level.

...
log_file_mode _Flag

Log file open mode.

...
log_format _Value

Log format used by the logging module.

...
log_level _Value

Level of messages to catch/display.

...
m _Value

Only run tests matching given mark expression.

...
markers _Flag

show markers (builtin, plugin and per-project ones).

...
max_warnings _Value

Exit with error if all tests pass but the number of warnings exceeds this threshold.

...
maxfail _Value

Exit after first num failures or errors.

...
nf _Flag

Run tests from new files first, then the rest of the tests sorted by file mtime.

...
no_cov _Flag

Disable coverage report completely (useful for debuggers).

...
no_cov_on_fail _Flag

Do not report coverage if test run fails.

...
no_fold_skipped _Flag

Do not fold skipped tests in short summary.

...
no_header _Flag

Disable header.

...
no_summary _Flag

Disable summary.

...
noconftest _Flag

Don't load any conftest.py files.

...
override_ini _Value

Override configuration option with "option=value" style, e.g. -o strict_xfail=True -o cache_dir=cache.

...
p _Value

Early-load given plugin module name or entry point (multi-allowed).

...
pastebin _Value

Send failed|all info to bpaste.net pastebin service.

...
pdb _Flag

Start the interactive Python debugger on errors or KeyboardInterrupt.

...
pdbcls _Value

Specify a custom interactive Python debugger for use with --pdb.For example: --pdbcls=IPython.terminal.debugger:TerminalPdb.

...
pyargs _Flag

Try to interpret all arguments as Python packages.

...
pythonwarnings _Value

Set which warnings to report, see -W option of Python itself.

...
quiet _Flag

Decrease verbosity.

...
report_chars _Value

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. May be repeated: a list emits the flag once per item. Defaults to fE.

...
rootdir _Value

Define root directory for tests.

...
runxfail _Flag

Report the results of xfail tests as if they were not marked.

...
s _Flag

Shortcut for --capture=no.

...
setup_only _Flag

Only setup fixtures, do not execute tests.

...
setup_plan _Flag

Show what fixtures and tests would be executed but don't execute anything.

...
setup_show _Flag

Show setup of fixtures while executing tests.

...
show_capture _Flag

Controls how captured stdout/stderr/log is shown on failed tests.

...
showlocals _Flag

Show locals in tracebacks (disabled by default). showlocals=off emits --no-showlocals.

...
strict _Flag

Enables the strict option.

...
strict_config _Flag

Enables the strict_config option.

...
strict_markers _Flag

Enables the strict_markers option.

...
sw _Flag

Exit on test failure and continue from last failing test next time.

...
sw_reset _Flag

Resets stepwise state, restarting the stepwise workflow.

...
sw_skip _Flag

Ignore the first failing test but stop on the next failing test.

...
tb _Value

Traceback print mode (auto/long/short/line/native/no).

...
trace _Flag

Immediately break when running each test.

...
trace_config _Flag

Trace considerations of conftest.py files.

...
verbose _Flag

Increase verbosity.

...
verbosity _Value

Set verbosity.

...
xfail_tb _Flag

Show tracebacks for xfail (as long as --tb != no).

...