unittest.TestCase and functools.partial don't seem to mix

Joel Smith js-pythonlist at jk1.net
Tue Oct 6 23:01:34 CEST 2009

Gabriel Genellina wrote:
> Note that you don't *have* to use partial in this case, as you're 
> building the suite yourself. Just create the TestCase instances manually:
>     suite = unittest.TestSuite([
>       TestGenericWindow('testit', 'brown'),
>       TestGenericWindow('testit', 'blue'),
>       TestGenericWindow('testit', 'green')
>       ])
>     unittest.TextTestRunner().run(suite)

Perfect!  This is exactly what I needed.  For some reason, I didn't
understand that I could construct my TestCase objects directly... I
thought that I had to allow the unittest framework to construct them for
me.  This is straightforward, and does exactly what I need.
Many thanks,

More information about the Python-list mailing list