getting started with pytest (beginner - intermediate) anthony explains #518

preview_player
Показать описание
I realize I've talked a lot about pytest on the channel, but never given it a proper introduction!

==========

I won't ask for subscriptions / likes / comments in videos but it really helps the channel. If you have any suggestions or things you'd like to see please comment below!
Рекомендации по теме
Комментарии
Автор

8:20 pytest also prints out whatever was written to stdout whenever a test fails. So if you're debugging a failing test you can read the output even without using -s.

tobb
Автор

-v{1, 3} is also very helpful when tests with a more complex comparison fail, e.g. long strings, lists/tuples/dicts with many items. It shows you exactly where the difference occurred, what item is missing etc.
It helps me a lot breaking this down

theendlessriver
Автор

I've been on your stream and I didn't realise that you're one of the folks behind PyTest. Good on ya!

iggypei
Автор

Didn't know that including __init__.py would resolve name collisions - thanks!

StanislavSchmidt
Автор

11:57 actually, when I run pytest from the command line, it doesn't work without the __init__.py

shekelboi
Автор

I assume the `-s` and suppression of I/O extends to the code not only in the test file (t_test.py) but also the original file (t.py)?

DavidDellsperger
Автор

Nice video, just checked I was sure unit test wasn’t in Python 1. Python predates junit by about 7 years and unit test was inspired by junit. python
20 February 1991. JUnit was born on a flight from Zurich to the 1997 OOPSLA in Atlanta.

varioustoxins
Автор

I never knew there was a name to call how you name your variables:
camelCase
snake_case
PascalCase
kebab-case

johnwt
Автор

flask app is dockerized. Uses rq worker, redis, postgres as compose services. How should one thing about testing such application?

yomajo
Автор

Nice video, exactly what I was looking for and the right amount of detail and explanation. The only downside is you have not done a video on Allure reporting :)

MrBillyClanton
Автор

I honestly prefer unittest. It is just nice to have it integrated in the language. Other than that I don't use it very differently from how you use pytest in this video.

wwijsman
Автор

Thanks, Anthony. Can you make a video about 'indirect' in parametrize?
And also request param in fixtures?

dukex
Автор

Why all files of pyupgrade starts with _?

alice-smith
Автор

Awesome video! can we also have a video on Mock, patching, monkey patch..etc please!

reyjanson
Автор

TIL about -s for print debugging an incorrectly passing test. I've normally just gone with the tried and true 1 / 0 in the test if it comes to that. haha

The plugins certainly make the tool shine brighter than it already does. Off the top of my head, pytest-randomly and pytest-repeat are two I use regularly to shake out and expose tricky pollution.

preocts
Автор

why do you put an underscore infront of main like _main.py, and the other files

jeffreyalidochair
Автор

Thanks a lot for the video. Coming from other language backgrounds, it helped a lot to clarify some info. Plus, it was short and enlightening

araujoao
Автор

Great video!
I've quickly tested some time ago unittest from python and I found out that writing assertion keyword is not strictly prohibited, maaaaybeee they changed something? I don't know. But pytest is by far most useful 3rd party tool downloadable from PIP! Thanks for sharing this tutorial!

dstinYwOw
Автор

Hey Anthony! Why do you not like oop? 😊 its a battle am fighting to learn or not but i checked many of your repos and didnt see you using classes, so was hoping to hear your thoughts

muddasirkhan
Автор

Thanks for the video! Many of your repos have testing directory, what do you store there? A code that is related for tests but you keep it separate because tests directory should contain only tests? Or my guess is wrong

tandavme