Zachary Ware added the comment:

I got to looking over my patch here again, and thought of another possible fix. 
 I'm not sure which is uglier, though :)

The problem is that most of the test cases are created using a custom subclass 
of unittest.TestCase which takes extra constructor arguments.  Discovery 
doesn't expect a TestCase subclass to want extra arguments, so it fails noisily 
trying to 'discover' RobotTestCase.

Patch version 2 just makes a couple small adjustments to version 1, which 
replaces the custom subclass with a base class to provide runTest, and a 
factory function to create the TestCase instances.

Version 3 is a different approach, which provides default arguments to the 
extra constructor parameters, and bails out of __init__ early if the index 
argument is not an int (checking for None doesn't work because at some point, 
discovery calls 'RobotTestCase("runTest")', which makes 'index' "runTest").

Both approaches look kind of ugly to me, but both get the job done.

----------
Added file: http://bugs.python.org/file29307/test_robotparser_discovery.v2.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17066>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to