mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 00:05:36 +00:00
Bug 1622637 - Fix exception reraising in mozrunner r=gbrown
Differential Revision: https://phabricator.services.mozilla.com/D66895 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
6bd4554518
commit
96b10ced72
@ -131,9 +131,11 @@ class BaseRunner(object):
|
||||
process.run(self.timeout, self.output_timeout)
|
||||
|
||||
self.process_handler = process
|
||||
except Exception:
|
||||
_, value, tb = sys.exc_info()
|
||||
reraise(RunnerNotStartedError, "Failed to start the process: %s" % value, tb)
|
||||
except Exception as e:
|
||||
reraise(RunnerNotStartedError,
|
||||
RunnerNotStartedError(
|
||||
"Failed to start the process: {}".format(e)),
|
||||
sys.exc_info()[2])
|
||||
|
||||
self.crashed = 0
|
||||
return self.process_handler.pid
|
||||
|
@ -5,6 +5,10 @@ from __future__ import absolute_import
|
||||
from time import sleep
|
||||
|
||||
import mozunit
|
||||
from mock import patch
|
||||
from pytest import raises
|
||||
|
||||
from mozrunner import RunnerNotStartedError
|
||||
|
||||
|
||||
def test_start_process(runner):
|
||||
@ -48,5 +52,13 @@ def test_start_with_outputTimeout(runner):
|
||||
assert not runner.is_running()
|
||||
|
||||
|
||||
def test_fail_to_start(runner):
|
||||
with patch('mozprocess.ProcessHandler.__init__') as ph_mock:
|
||||
ph_mock.side_effect = Exception('Boom!')
|
||||
with raises(RunnerNotStartedError):
|
||||
runner.start(outputTimeout=0.1)
|
||||
sleep(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
mozunit.main()
|
||||
|
Loading…
Reference in New Issue
Block a user