Python tests | Pytest Mock and Patch

Опубликовано: 04 August 2026
на канале: jobstr
44,606
439

Unit Tests (Pytest in this case) can save you time. Here we look at how to use mock and patch with some code to make requests and then I disconnect from the internet and my 'parse' function still passes the test.

This is intended as a basic, but useful intro to the world of Pytest and Mock and Patch.

Also includes a few tips on folder structure and using __init__.py

Use this link for excellent hosting with Python installed :
🌏 https://webdock.io/en?maff=wdaff--170

👍 Become a patron 👍
🌏   / drpi  

Code : https://github.com/RGGH/mok

Buy Dr Pi a coffee (or Tea)
☕ https://www.buymeacoffee.com/DrPi

Thumbs up yeah? (cos Algos..)

Python Tutorial
Pytest vscode
Pytest tutorial
Pytest mock requests example
Pytest patch

#pytest #requests #pythonprogramming