[issue14408] Support ./python -m unittest in the stdlib tests

Michael Foord report at bugs.python.org
Thu Mar 29 15:26:55 CEST 2012


Michael Foord <michael at voidspace.org.uk> added the comment:

It still looks weird to see code calling methods that obviously don't exist, and with no indication *at the call site* where they come from. Making it clearer with naming would help: "TestThingMixin" or similar.

There are classes like this in the unittest test suite, and I was very confused by them initially until I found where and how they were used. It is obviously *not* a pattern that is widely known for test base classes, as we have this problem of it not being done even in the standard library tests.

In contrast I think code similar to the following would be clear and readable without knowing about multiple inheritance and the mixin trick:

    @test_base_class
    class SomeTestBase(TestCase):
        ...

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14408>
_______________________________________


More information about the Python-bugs-list mailing list