comparison tests/run-tests.py @ 49217:13dfad0f9f7a

branching: merge stable into default
author Raphaël Gomès <rgomes@octobus.net>
date Wed, 25 May 2022 13:28:24 +0200
parents ea98850a136e 8d31ef3017c9
children cd51d4957b28
comparison
equal deleted inserted replaced
49212:d3d3495a5749 49217:13dfad0f9f7a
2503 2503
2504 runtests = list(tests) 2504 runtests = list(tests)
2505 done = queue.Queue() 2505 done = queue.Queue()
2506 running = 0 2506 running = 0
2507 2507
2508 channels_lock = threading.Lock()
2508 channels = [""] * self._jobs 2509 channels = [""] * self._jobs
2509 2510
2510 def job(test, result): 2511 def job(test, result):
2511 for n, v in enumerate(channels): 2512 with channels_lock:
2512 if not v: 2513 for n, v in enumerate(channels):
2513 channel = n 2514 if not v:
2514 break 2515 channel = n
2515 else: 2516 break
2516 raise ValueError('Could not find output channel') 2517 else:
2517 channels[channel] = "=" + test.name[5:].split(".")[0] 2518 raise ValueError('Could not find output channel')
2519 channels[channel] = "=" + test.name[5:].split(".")[0]
2520
2521 r = None
2518 try: 2522 try:
2519 test(result) 2523 test(result)
2520 done.put(None)
2521 except KeyboardInterrupt: 2524 except KeyboardInterrupt:
2522 pass 2525 pass
2523 except: # re-raises 2526 except: # re-raises
2524 done.put(('!', test, 'run-test raised an error, see traceback')) 2527 r = ('!', test, 'run-test raised an error, see traceback')
2525 raise 2528 raise
2526 finally: 2529 finally:
2527 try: 2530 try:
2528 channels[channel] = '' 2531 channels[channel] = ''
2529 except IndexError: 2532 except IndexError:
2530 pass 2533 pass
2534 done.put(r)
2531 2535
2532 def stat(): 2536 def stat():
2533 count = 0 2537 count = 0
2534 while channels: 2538 while channels:
2535 d = '\n%03s ' % count 2539 d = '\n%03s ' % count