[Python-Dev] Adding test case methods to TestCase subclasses
Ben Finney
ben+python at benfinney.id.au
Fri Apr 15 23:25:28 CEST 2011
Ethan Furman <ethan at stoneleaf.us> writes:
> Ben Finney wrote:
> > TestCase subclasses is a multiple-inheritance use case that I share.
> > The mix-ins add test cases (methods named ‘test_’ on the mix-in
> > class) to the TestCase subclass. I would prefer not to use multiple
> > inheritance for this if it can be achieved in a better way.
> >
> > How can composition add test cases detectable by Python's ‘unittest’?
>
> Metaclasses, if's that an option...
[…]
> or a class decorator
[…]
Both interesting, thank you. But Python 3 isn't an option for several
projects where I'd like to use this.
--
\ “What is needed is not the will to believe but the will to find |
`\ out, which is the exact opposite.” —Bertrand Russell, _Free |
_o__) Thought and Official Propaganda_, 1928 |
Ben Finney
More information about the Python-Dev
mailing list