Home

pytest

Pytest is a mature Python testing framework used to write simple unit tests and complex functional tests. It emphasizes readable test code and provides powerful features while remaining easy to use. Pytest originated as py.test, created by Holger Krekel, and later adopted the pytest name as the project matured. It is one of the most widely used testing tools in the Python ecosystem.

Key features include a powerful assertion introspection that shows details in failures, a rich fixture system

Usage: Install via pip, then run pytest from the project root to discover and execute tests. Tests

Plugin architecture and ecosystem: Pytest provides a robust plugin architecture; thousands of plugins extend reporting, coverage,

for
setup
and
modular
test
components,
and
support
for
parametrized
testing
to
run
the
same
test
with
different
data.
Tests
are
discovered
automatically
by
name
convention,
without
requiring
classes
or
boilerplate,
though
class-based
tests
are
supported.
Pytest
supports
markers
to
categorize
tests
and
to
customize
behavior.
It
also
integrates
with
unittest-style
tests
and
can
run
with
numerous
plugins
for
coverage,
mocking,
and
specialized
frameworks
like
Django
or
Flask
applications.
are
typically
written
as
functions
named
test_...,
using
plain
Python
assert
statements.
Fixtures
are
defined
with
the
fixture
decorator
and
can
be
composed
and
scoped
(function,
module,
session).
Parametrization
is
done
with
the
parametrize
decorator
to
create
multiple
test
cases
from
a
single
test
function.
parallel
execution,
and
integrations
with
CI
systems.
It
has
a
large
ecosystem
of
community
contributions
and
is
widely
used
in
continuous
integration
workflows.