Город МОСКОВСКИЙ
00:10:12

Python tests | Pytest Mock and Patch

Аватар
JavaScript для веб-разработки
Просмотры:
25
Дата загрузки:
29.11.2023 17:19
Длительность:
00:10:12
Категория:
Технологии и интернет

Описание

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 ?
? https://www.patreon.com/drpi

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

Proxies
=================================================
If you need a good, easy to use proxy, I was recommended this one, and having used ScraperAPI for a while I can vouch for them. If you were going to sign up anyway, then maybe you would be kind enough to use the link and the coupon code below?

You can also do a full working trial first as well, (unlike some other companies). The trial doesn't ask for any payment details either so all good! ?

? 10% off ScraperAPI : https://www.scraperapi.com?fpr=ken49
◼️ Coupon Code: DRPI10

Thumbs up yeah? (cos Algos..)

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

#pytest #requests #pythonprogramming

Рекомендуемые видео