8 Comments

Also i had to import random package directly to make it work, but in your examples there is no such import. Maybe we use different pythons(3.10 here), but if it is not a case you may want to correct that in your example :)

Great read as always.

Expand full comment

Thanks. I need a button for people pushing directly fixes to the article, like a github PR :)

This way I can say it's not that I mess up, it's that I'm encouraging contribution!

Expand full comment

Like "solve this puzzle", not like "I forgot". Very pedagogical :)

Expand full comment

HI BiteCode, great article as always :)

I think there is a typo with your last example. The fixture "random_number" must be an argument of the function and not the decorator.

Expand full comment

thank you. Testing is the part of my learning journey that I wanted to tackle next, so this series was timely. And the missing import was pretty easy to figure out, but I didn't know enough about Pytest to know why I was getting an error about fixture being applied more than once to the same function

Expand full comment

Do you mean an another consequence of an error in the article or the fact your used @pytest.fixture on 2 functions with the same name?

Expand full comment

Thanks !

Expand full comment

you are welcome :)

Expand full comment