[TIP] cleanUp for unittest
Victoria G. Laidler
laidler at stsci.edu
Fri Apr 3 11:49:17 PDT 2009
Michael Foord wrote:
> There is no need for the lambdas in the above example.
>> and I'm dithering on whether I think it ought to be a list, as
>> proposed, or something else.
>> My usual case for cleanup behavior is file deletion, with different
>> files to be deleted depending on how far I got. Would this work?
> You do need a lambda (or function) to do this however. :-)
> self.cleanUp.append(lambda: os.unlink(somefile))
OK... what is the difference between the two? Just that the method takes
an argument? I'm still lambda-befuzzled, here.
More information about the testing-in-python