After looking at the new stuff available in unit tests:
http://docs.python.org/library/unittest.html
I am really sold! At a mere glance I can already see two things that would be supremely useful in cleaning up my tests which is:
doCleanups
and
assert*Equal
Especially the assertTupleEqual and assertListEqual is really really nice where in the difference of the two sets are compared and the diff included in the failed message. We are using Ubuntu on all of our tests machines so I really hope that the stock Python that comes with the next version of Ubuntu is the 2.7.x branch. The assertAlmostEqual seems a bit dodgy to me but then again I still haven't really gone in depth with the docs yet.
What would be a nice addition for me would be 'assertTextFileEqual' or something to that end. This would be a great shortcut for me as I do a lot of text file reading and asserting in my tests.
All in all kudos to the changes made in the unit test module of Python and I like the direction that it's heading.
Sunday, October 9, 2011
Subscribe to:
Posts (Atom)