comparison Tests/Toolbox.py @ 138:0682740fcfcb

cleanup
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 25 May 2018 11:08:58 +0200
parents 412d5f70447e
children ed3db6386587
comparison
equal deleted inserted replaced
137:412d5f70447e 138:0682740fcfcb
221 elif s == 'Failure': 221 elif s == 'Failure':
222 return False 222 return False
223 223
224 time.sleep(0.1) 224 time.sleep(0.1)
225 225
226 def MonitorJob(orthanc, func): # "func" is a lambda
227 a = set(DoGet(orthanc, '/jobs'))
228 func()
229 b = set(DoGet(orthanc, '/jobs'))
230
231 diff = list(b - a)
232 if len(diff) != 1:
233 print('No job was created!')
234 return False
235 else:
236 return WaitJobDone(orthanc, diff[0])
237
226 def GetDockerHostAddress(): 238 def GetDockerHostAddress():
227 route = subprocess.check_output([ '/sbin/ip', 'route' ]) 239 route = subprocess.check_output([ '/sbin/ip', 'route' ])
228 m = re.search(r'default via ([0-9.]+)', route) 240 m = re.search(r'default via ([0-9.]+)', route)
229 if m == None: 241 if m == None:
230 return 'localhost' 242 return 'localhost'