> Same thing here, I think that the code is OK, but apart of the comment
> Javier's suggested, I would also appreciate a comment on why it was decided to
> remove application as an init method parameter.
> (commenting here in launchpad, I mean)
It is hard (not clean) to subclass an Application class, and include it as the factory for the TestSuite class.
The specific use-case is the pidgin_messaging.py script overrides Application.open() and Application.close().
Before the app/suite split, it was an easy override, but now we need to:
1. Override Pidgin as PidginUseApp
2. Override PidginUseTest.__init__(), re-implement it without calling the superclass init, because it will provide (and use) the wrong factory. Here is what it looks like:
class PidginUseApp(Pidgin):
def open(self): Pidgin.open(self) self.buddy_login() self.wait_for_account_connect(self.get_account_name('XMPP'), 'XMPP') self.wait_for_buddy(self.get_account_alias('OtherXMPP'))
> Same thing here, I think that the code is OK, but apart of the comment
> Javier's suggested, I would also appreciate a comment on why it was decided to
> remove application as an init method parameter.
> (commenting here in launchpad, I mean)
It is hard (not clean) to subclass an Application class, and include it as the factory for the TestSuite class.
The specific use-case is the pidgin_messaging.py script overrides Application.open() and Application. close() .
Before the app/suite split, it was an easy override, but now we need to: __init_ _(), re-implement it without calling the superclass init, because it will provide (and use) the wrong factory. Here is what it looks like:
1. Override Pidgin as PidginUseApp
2. Override PidginUseTest.
class PidginUseApp( Pidgin) :
Pidgin. open(self)
self.buddy_ login()
self.wait_ for_account_ connect( self.get_ account_ name('XMPP' ), 'XMPP')
self.wait_ for_buddy( self.get_ account_ alias(' OtherXMPP' ))
def open(self):
def close(self):
self.buddy. disconnect( )
Pidgin. exit(self)
class PidginUseTest( PidginTestSuite ):
profile_ template= '',
credentials= ''):
self.clean_ profile = clean_profile
self.profile_ template = profile_template
self.credentia ls = credentials
SingleApplicat ionTestSuite. __init_ _(self, PidginUseApp)
def __init__(self, clean_profile=True,
With my changes, besides overriding Pidgin, you just need to override a static class attribute.
Phew!!