[TIP] Guidelines for where to put tests & how to package them

Olemis Lang olemis at gmail.com
Mon Mar 1 05:44:58 PST 2010


On Mon, Mar 1, 2010 at 8:37 AM, Michael Foord <fuzzyman at voidspace.org.uk> wrote:
> On 01/03/2010 13:32, Olemis Lang wrote:
>>
>> On Sat, Feb 27, 2010 at 2:33 PM, Michael Foord
>> <fuzzyman at voidspace.org.uk>  wrote:
>>
>>> On 27/02/2010 19:22, C. Titus Brown wrote:
>>
>> [...]
>>
>>>
>>> Olemis was confused as to what setuptools did - it does not support a
>>> callable for the test_suite argument.
>>
>> I was terribly wrong about `suite` and `unittest`, yes, however if
>> there's something wrong with the following snippet
>
> According to the setuptools documentation the test_suite argument *can* be a
> callable. So you were right about that and Phillip was wrong!
>

JFYI , we are both right

{{{
#!python

# unittest Python 2.5

    def loadTestsFromName(self, name, module=None):
        # further code omitted ;o)

        # Mainly because of this ;o)
        elif callable(obj):
            test = obj()
            if not isinstance(test, (TestCase, TestSuite)):
                raise ValueError, \
                      "calling %s returned %s, not a test" % (obj,test)
            return test
}}}

-- 
Regards,

Olemis.

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:



More information about the testing-in-python mailing list