IT-lexikon › Programmering › pytest

pytest

Programmering In English → Uppdaterad: 2026-05-23
Mer info
Skapad av
Holger Krekel
År
Typ
Python test-runner
Licens
MIT
Officiell sajt
Källkod
github.com/pytest-dev/pytest

Pythons de facto-standard test-runner — minimal syntax, kraftfulla fixtures, parametrize. Slog ut unittest från standard library.

Skriv def test_foo(): assert x == y. Inget class-arv som unittest. Fixtures (via @pytest.fixture + dependency injection) är killer-feature. @pytest.mark.parametrize för data-driven tester. Pluginekosystem är massivt: pytest-django, pytest-asyncio, pytest-cov, hypothesis (property-based testing). Default i de flesta moderna Python-projekt.

← Tillbaka till lexikonet