Pytest
Contents
Pytest#
Pytest is a tool for writing and running tests.
See also
Install#
Usage#
Getting Help#
Running Tests#
Verbose Mode#
- [ ] invocation (run) - [ ] help 
- [ ] running a single test ( - -kor test_name.py::test_name)
- [ ] verbose mode - [ ] - -v: verbose
- [ ] - -x: fail on first tests
- [ ] - -k: expression
- [ ] - -tb=short: shorter tracebacks
- [ ] - --pdb: start debugger on failures
- [ ] - --trace: start debugger with breakpoint at the beginning of each test
- [ ] - --pdbcls=IPython.terminal.debugger:TerminalPdb: use the ipython debugger
- [ ] running single test, filtering to matching names 
 
 
Quickref#
| Flag | Description | 
|---|---|
| 
 | Help | 
| 
 | Exit on first error | 
| 
 | start debugger on error | 
| 
 | add breakpoint to beginning of each test | 
| 
 | don’t capture stdout and stderr | 
| 
 | show local variable and their values | 
| 
 | print shorter tracebacks | 
See also#
See also
TODO#
- [x] install 
- [ ] setup - [ ] pyproject.html: testpaths, addopts 
 
- [ ] conftest.py 
- [ ] plugins - [ ] pytest-only (add only marker) 
- [ ] pytest-parametrization 
- [ ] pytest-clarity (prettier assert diffs) 
- [ ] adding to - pyproject.toml- [tool.pytest.ini_options] testpaths = ["tests"] addopts = "-vx"