On Wednesday, May 18, 2016 at 8:06:11 AM UTC-4, Thomas Mlynarczyk wrote: > On 17/05/16 12:39, Cem Karan wrote: > > Just downloaded and used a library that came with unit tests, which all > > passed. > > [...] > > I discovered they had commented out the bodies of some of the unit > tests... > > Shouldn't the unit test framework have those "empty" tests reported as > "todo"/"incomplete" or whatever? (I know that PHPUnit reports such tests > as "passed" which I find utterly wrong.)
The xUnit pattern is that if a test runs without an error or a failed assertion, then the test passes. An empty test function that does nothing will meet this criterion, so it passes. Ideally, an empty test wouldn't be a success, but I'm not sure how the test runner could determine that it was empty. I guess it could introspect the test function to see if it had any real code in it, but I don't know of a test runner that does that. --Ned. -- https://mail.python.org/mailman/listinfo/python-list