DEV Community

Nicholus Mush
Nicholus Mush

Posted on

Testing & Debugging Python

title: Testing & Debugging Python — pytest, logging, pdb
published: false
tags: [python, testing, debugging, pytest]

Testing and debugging keep projects healthy. This post covers pytest basics,
using logging for observability, and pdb for interactive debugging.

Quick pytest example:

def add(a, b):
    return a + b

def test_add():
    assert add(2, 3) == 5
Enter fullscreen mode Exit fullscreen mode

Run pytest -q to execute tests and prefer small, focused unit tests.

Top comments (0)