Intro to Pytest
docs.pytest.org·10w·
Discuss: DEV

pytest: helps you write better programs

The pytest framework makes it easy to write small, readable tests, and can scale to support complex functional testing for applications and libraries.

PyPI package name: pytest

A quick example

# content of test_sample.py
def inc(x):
return x + 1


def test_answer():
assert inc(3) == 5

To execute it:

$ pytest
=========================== test session starts ============================
platform linux -- Python 3.x.y, pytest-9.x.y, pluggy-1.x.y
rootdir: /home/sweet/project
collected 1 item

test_sample.py F                                                     [100%]

==========...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help