Pytest is one of the best tools used to boost software testing productivity.
Run tests in a module.
Run tests in a directory.
Run a specific test within a module.
Run a specific method of a class.
Run tests by keyword expression.
Run tests by marker expression.
Shows builtin and custom fixtures.
Shows builtin and custom markers.
Run only the failed tests from the previous run.
Rerun the failures first and then successful tests.
Exit immediately on first error or failed test.
Disable the display of warnings summary.
Generate the HTML report at given path [pytest-html].
Display a short test summary info.
The -r option accepts a number of characters after it. Default is fE to list failures and errors.
f - failed
E - error
s - skipped
x - xfailed
X - xpassed
p - passed
P - passed with output
Special characters for (de)selection of groups:
a - all except pP
A - all
N - none, this can be used to display nothing (since fE is the default)
Show local variable in traceback.
Show complete tracebacks. Default is to cut.
Pytest places a debugger breakpoint whenever an error occurs in tests.
Collect tests, don't execute them.
Lists all the Pytest and dependent packages command line options.
Number of processes to start. Can be a positive integer or Use 'auto' for auto detection CPUs number.
--dist no/ loadscope/ loadfile
Select the test distribution algorithm with the --dist option.
Distributing algorithm values are
no: --numprocesses will send pending tests to any worker that is available, without any guaranteed order.
loadscope: Tests are grouped by the module for test functions and by class for test methods.
loadfile: Tests are grouped by their containing file.
Create and update testruns.
Defaults to testrail.cfg .
Name given to Testrun.
pytest --testrail --tr-config= testrail.cfg
Testrail config file template:
url = https://yoururl.testrail.net/
email = email@example.com
password = <api_key>
assignedto_id = <user-id>
project_id = <project-id>
suite_id = <test-suite-id>
name = <test-run-name>
Help Us Go Positive!
We offset our carbon usage with Ecologi. Click the link below to help us!