How to write unit tests in Python • Pytest tutorial

How to write unit tests in Python • Pytest tutorial

HomepixegamiHow to write unit tests in Python • Pytest tutorial
How to write unit tests in Python • Pytest tutorial
ChannelPublish DateThumbnail & View CountDownload Video
Channel AvatarPublish Date not found Thumbnail
0 Views
Learn how to test your Python code by writing unit tests using the Pytest framework.

In this video I explain how to write and run unit tests, how to check if an error occurs, how to use test fixtures, and how to simulate dependencies.

Code: https://github.com/pixegami/simple-pytest-tutorial
Pytest documentation: https://docs.pytest.org/
Unittest mock: https://docs.python.org/3/library/unittest.mock.html

Chapter

00:00 Introduction
02:45 Install Pytest and set up the project
04:14 Running your first unit test
06:50 Implement your test (with /"assert/")
11:24 How to test if an error occurs
18:30 How to run a specific unit test file/method
19:50 How to display print statements in pytest
20:27 Implementation of the test /"get_total_price/"
23:10 Using pytest fixtures to set up the context for your tests
27:00 If your tests depend on another module
30:50 How to simulate dependencies (with unittest mock)
34:30 Conclusion

#pytest #python

Please take the opportunity to connect with your friends and family and share this video with them if you find it useful.