I have a python class , which inherits multiple classes, and have test_func() with same name
parent.py
class parent:
def __init__(self, **kwargs):
self.ip = kwargs.get('ip')
self.name = kwargs.get('name')
self.local = kwargs.get('local')
class child1(parent):
def __init__(self,**kwargs):
parent.__init__(self,**kwargs)
def test_func(self):
print 'When local =true'
return self.name
class child2(parent):
def __init__(self,**kwargs):
parent.__init__(self,**kwargs)
def test_func(self):
print ("When local =False")
return self.ip
class child3(parent,child1,child2):
def __init__(self, **kwargs):
parent.__init__(self, **kwargs)
There is an environment file , where i am initializing the class
from parent import parent
from child2 import child2
from child1 import child1
from parent import child3
server=child3(
ip = '10.20.11.10',
name ='pankaj',
local = False
)
I have a robotfile (Test.robot) which calls the method test_func
*** Settings ***
Library parent.child3 WITH NAME wireshark_test
*** Variables ***
*** Test Cases ***
This is first
Invoking methods
*** Keywords ***
Invoking methods
log to console wireshark_test.test_func
i am executing this via command
pybot -V envSI.py Test.robot
I am always getting test_func of child1 class
Expectation:
When local=True test_func of child1 class Else test_func of child2 class
Could anyone please guide me how can i do this?