Quote of the day
Ned Batchelder
ned at nedbatchelder.com
Wed May 18 11:21:04 EDT 2016
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.
More information about the Python-list
mailing list