flask-testing
flask-testing copied to clipboard
Is this the correct way to run the tests?
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.
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/