Running Nosetest on Ex47?


#21

I understand now. The program did run, it just had nothing to display as no functions were called. This is why there were no error messages. I tried to include print statements, but those did not print anything, which I assume is because I did not call the function.

I thought ex47_tests.py would run as I did not understand that “testing” the code meant using nosetests, instead of running the program using a python command. This is why the nil result confused me.

I am assuming that nosetests catches failures that would not show up when running modules(?) using the python command on its own.


#22

Yep, bingo! Now you get it. Basically, the code is just fine. You just have to use nosetests to run the test code. You should also take a look at pytest:

https://docs.pytest.org/en/latest/

It is a little easier to use and is actually maintained.