Skip to content

Latest commit

 

History

History
167 lines (87 loc) · 3.88 KB

File metadata and controls

167 lines (87 loc) · 3.88 KB

venv

pip

pytest site

Python's subprocess.run

Dictionary view objects

Demo of Python failure reports with pytest

Assertion rewriting

ExceptionInfo

The Arrange-Act-Assert or Given-When-Then pattern

Pathlib

pytest fixtures

pytest pytest_generate_tests metafunc

Coverage.py

The preferred Python coverage tool that measures code coverage

$ pip install coverage

pytest-cov

A popular pytest plugin often used in conjunction with coverage.py

$ pip install pytest-cov

tox

GitHub Actions

GitHub Actions is a cloud-based CI system provided by GitHub.

unittest.mock

Typer

Typer is a library for building CLI applications.

Python: Autospeccing

Python: variants of assert_called

Plugins to assist mocking

The mocker fixture cleans up after itself, so a with block must not be used.

  • pytest-postgresql, pytest-mongo, pytest-mysql, and pytest-dynamodb for mocking database access

  • pytest-httpserver for mocking HTTP servers

  • responses and betamax for mocking requests

  • pytest-rabbitmq, pytest-solr, pytest-elasticsearch, pytest-redis, and others

pdb = Python debugger

Full list of pytest plugins

Filter by Framework::Pytest on PyPI to find packages that include a pytest plugin but aren't named pytest- or -pytest.

Submitting plugins to pytest-dev

Some popular pytest plugins

Pytest: hook functions

Pytest: Making your plugin installable by others

Flit: pyproject.toml

Pytest: pytester

Pytest: RunResult

Tox: Generative environment list