uwhpsc-2016 / homework2

Homework #2
0 stars 3 forks source link

Not running tests #23

Open anders34 opened 8 years ago

anders34 commented 8 years ago

When I run

$ python test_homework2.py

why doesn't it run the new code that I've written in the class TestSolver?

quantheory commented 8 years ago

This was an interesting issue that I haven't seen before. The problem is that you have the indented block at the very end (if __name__ == '__main__':). This means that it is considered part of the definition of the TestSolver class, so that class is not finished being defined when it is run. As a result, the TestSolver class is not processed by the unittest module.

The simple solution is to remove one level of indentation from that if block at the end.

anders34 commented 8 years ago

Ah, makes sense. Thank you!