You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Automatically assing unique names to pipeline hooks #3541
In the case of mixins and library tests that are meant to be used by other tests, it is a good idea to define the hook names with a unique pattern, e.g., _<ClassName>_<hook_name>, to avoid derived tests accidentally overriding the library or mixin hook which are supposed to provide extra functionality to the test.
Even if a base class wants to override a hook to redefine it or disable it, it would still be able to do it, but in a more explicit way, which I think is good:
classPlugin(RegressionMixin):
@run_before('run', always_last=True):
defdo_sth(self):
...
@simple_testclassDerivedTest(RegressionTest, Plugin):
def_Plugin_do_sth(self):
# Short circuit the hookpass@simple_testclassDerivedTest2(RegressionTest, Plugin):
# Detach base class hook and re-attach it belowdef_Plugin_do_sth(self):
super()._Plugin_do_sth()
@run_before('run')defdo_sth_else(self):
self._Plugin_do_sth()
Activity