[Imps] html5lib patch to use unittest

Sam Ruby rubys at intertwingly.net
Mon Dec 11 06:28:27 PST 2006

James Graham wrote:
> Sam Ruby wrote:
>> See attachment.  Also corrects a few typos and allows the testcase to 
>> be run from any directory.
> Hi Sam.
> Thanks for the patch. I was previously writing the tests to work with 
> the nose test discovery framework [1] (unfortunately I had neglected to 
> check in the README file which explains this). Unfortunately the "single 
> function that generates multiple tests using yield" approach is not 
> trivial to share between nose and the standard unittest. Do you believe 
> it's worth sticking with the standard module rather than adding the 
> extra dependency for test discovery and execution (imho the compelling 
> feature of nose is the simplicity of the test format and discovery; no 
> need to make everything a subclass of UnitTest, tests are just 
> identified by function name)? Alternatively, I could try and work a way 
> for both frameworks to coexist, but I'm tempted to say there should be 
> just one way to do it. I would appreciate your opinion on which way this 
> should be.

How complicated do you expect the rule to be which identifies tests?

If you check, you will see that I kept the "single function that 
generates multiple tests using yield"... the tests themselves don't have 
to be in a class which subclasses off of UnitTest, instead they are 
grafted on later.

Since you asked, my first preference is to avoid dependencies which are 
not in the standard library.  My second preference is to avoid 
dependencies which are not available via apt-get in Ubuntu.  The latter 
brings in json, but does not bring in nose.

The fact that it is Ubuntu isn't important, it merely is an indirect 
measure of how common or standard a given module is.  My experience is 
that the more non-standard and non-common you go, the smaller the 
development community will be, and the more fragile the module itself 
will be.

But if you decide to go for nose, then I would agree, there is no need 
for UnitTest.

- Sam Ruby

More information about the Implementors mailing list