コード例 #1
0
ファイル: testcase.py プロジェクト: alexxa/dva
 def match(self, connection, command, regexp, grouplist=[1], timeout=10):
     """ Expect.match wrapper """
     try:
         Expect.enter(connection, command)
         result = Expect.match(connection, regexp, grouplist, timeout)
         self.log.append({"result": "passed", "match": regexp.pattern, "command": command, "value": str(result)})
         return result
     except ExpectFailed, err:
         self.log.append({"result": "failed", "match": regexp.pattern, "command": command, "actual": err.message})
         return None
コード例 #2
0
ファイル: testcase.py プロジェクト: alexxa/dva
 def get_result(self, connection, command, timeout=10):
     """ Expect.match wrapper """
     try:
         Expect.enter(connection, "echo '###START###'; " + command + "; echo '###END###'")
         regexp = re.compile(".*\r\n###START###\r\n(.*)\r\n###END###\r\n.*", re.DOTALL)
         result = Expect.match(connection, regexp, [1], timeout)
         self.log.append({"result": "passed", "command": command, "value": result[0]})
         return result[0]
     except ExpectFailed, err:
         self.log.append({"result": "failed", "command": command, "actual": err.message})
         return None
コード例 #3
0
ファイル: testcase.py プロジェクト: dparalen/dva
 def match(self, connection, command, regexp, grouplist=[1], timeout=10):
     """ Expect.match wrapper """
     try:
         Expect.enter(connection, command)
         result = Expect.match(connection, regexp, grouplist, timeout)
         self.log.append({
             "result": "passed",
             "match": regexp.pattern,
             "command": command,
             "value": str(result)
         })
         return result
     except ExpectFailed, err:
         self.log.append({
             "result": "failed",
             "match": regexp.pattern,
             "command": command,
             "actual": err.message
         })
         return None
コード例 #4
0
ファイル: testcase.py プロジェクト: dparalen/dva
 def get_result(self, connection, command, timeout=10):
     """ Expect.match wrapper """
     try:
         Expect.enter(
             connection,
             "echo '###START###'; " + command + "; echo '###END###'")
         regexp = re.compile(".*\r\n###START###\r\n(.*)\r\n###END###\r\n.*",
                             re.DOTALL)
         result = Expect.match(connection, regexp, [1], timeout)
         self.log.append({
             "result": "passed",
             "command": command,
             "value": result[0]
         })
         return result[0]
     except ExpectFailed, err:
         self.log.append({
             "result": "failed",
             "command": command,
             "actual": err.message
         })
         return None