Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
How to use pytest (level beginner)
-
Hi!
My knowledge of Python and Pythonista is frankly low. Maybe you'll find this too easy and evident, but I've needed sometime to understand how to use pytest in Pythonista.
Here is an script showing how to use it:
import pytest def cuadrado(x): return x*x def test(): assert(cuadrado(2)==5) pytest.main()
Just import pytest and import or define your functions. Then, define your test and, finally, put pytest.main() to run the tests. That last line was the thing I couldn't find when I was reading the pytest tutorial.
Javier
Ps. Sorry for the bad English.