[Twisted-Python] Re: [Twisted-commits] r15200 - I'd like _setUp thanks
jml at mumak.net
Fri Nov 25 01:03:58 EST 2005
On 25/11/05, Jean-Paul Calderone <exarkun at divmod.com> wrote:
> On Fri, 25 Nov 2005 09:44:42 +1100, Jonathan Lange <jml at mumak.net> wrote:
> >On 25/11/05, Itamar Shtull-Trauring <itamar at itamarst.org> wrote:
> >> On Thu, 2005-11-24 at 00:09 -0700, Jonathan Lange wrote:
> >> > Modified: branches/jml/trial-deferred-logic/twisted/test/test_ssl.py
> >> > ==============================================================================
> >> > --- branches/jml/trial-deferred-logic/twisted/test/test_ssl.py (original)
> >> > +++ branches/jml/trial-deferred-logic/twisted/test/test_ssl.py Thu Nov 24 00:09:19 2005
> >> > @@ -173,7 +173,7 @@
> >> >
> >> > class StolenTCPTestCase(test_tcp.ProperlyCloseFilesTestCase, test_tcp.WriteDataTestCase):
> >> > def setUp(self):
> >> > - self._setUp()
> >> > + self._setUpStuff()
> >> If it happened here it might happen elsewhere... maybe use __ methods?
> >> Or some other name.
> >I'd like to use a single underscore because I expect these methods to
> >be overridden (that can't be a real word). So, I'd much prefer to
> >rename. Suggestions welcome.
> If you expect them to be overridden, they should not be underscore prefixed. Underscore prefix indicates privateness.
Ahh. I had taken it to indicate 'protectedness' (the standard says
"non-public"). This can be quickly fixed.
> Lastly, why do you expect them to be overridden? Do you just expect test_tcp.ProperlyCloseFilesTestCase and test_ssl.StolenTCPTestCase to override them, or do you expect other classes to do so? If the latter, why? If the former, what does it matter (and this code should be factored better, so the question is moot)?
I'm not expecting actual tests to override them. I was thinking more
of the use-case where someone extends TestCase to, say, DBTestCase,
which runs every test_ method inside a database transaction. To do
that, _testMethod would have to be overridden.
More information about the Twisted-Python