여러 응답을 테스트 할 때 함수를 여러 번 호출합니다. 나는이 함수의 변수를 변경하고 호출하는 방식으로 함수에서 더 일찍 함수를 호출하는 방법에 대해 묻는다. 다음은 코드 스 니펫입니다.함수를 호출하고 변수를 변경하는 방법
class AbsoluteMove(unittest.TestCase):
def Ssh(self):
p=pexpect.spawn('ssh [email protected]')
self.command = './ptzpanposition -c 0 -u degx10'
p.sendline("cd /bin")
i=p.expect('[email protected]:')
p.sendline(self.command)
i=p.expect('[email protected]:')
self.Value = p.before
class VerifyTilt(AbsoluteMove):
def runTest(self):
self.dest.PanTilt._y=2.0
try:
result = self.client.service.AbsoluteMove(self.token, self.dest, self.speed)
except suds.WebFault as detail:
print detail
self.command = './ptzpanposition -c 0 -u degx10'
AbsoluteMove.Ssh(self)
# Position of the camera verified through Ssh (No decimal point added to the Ssh value)
self.assertEqual(self.Value, '20')
나는 AbsoluteMove.Ssh()의 'self.command'변수를 변경 한 후이 기능을 실행합니다. 누구든지이 작업을 수행하는 방법을 알고 있습니까? 어떤 도움
당신은 runTest 기능에 대한 래퍼를해야합니다
"여기 어떻게 질문하나요?" 이 페이지 : http://stackoverflow.com/faq – Jorenko