flask-testing icon indicating copy to clipboard operation
flask-testing copied to clipboard

Is this the correct way to run the tests?

Open peoplecallmefrancois opened this issue 11 years ago • 1 comments

It's my first time doing Python testing.

In the docs, I saw the following at the end of a testing file:

if __name__ == '__main__': unittest.main()

However, in the example given, it does not have anything like this, so I decided to not put the above code. Do I need this code to run this test? Or does it work without?

Thanks for the help.

peoplecallmefrancois avatar Sep 29 '13 01:09 peoplecallmefrancois

See here: http://stackoverflow.com/questions/419163/what-does-if-name-main-do

That snippet is not necessary for running tests (especially if you are using something like Nose to automatically search and execute all your tests in a directory). If you are doing testing in Python for the first time, I strongly suggest that you check out Nose: https://nose.readthedocs.org/en/latest/

qdonnellan avatar Mar 16 '14 13:03 qdonnellan