def test_jsshell_install(mocker, mos, binary_name): zipfile = mocker.patch('mozregression.launchers.zipfile') zipfile.ZipFile = Zipfile mocker.patch('mozregression.launchers.mozinfo').os = mos with launchers.JsShellLauncher('/path/to') as js: assert os.path.isdir(js.tempdir) assert os.path.basename(js.binary) == binary_name assert not os.path.isdir(js.tempdir)
def test_jsshell_start(mocker, return_code): zipfile = mocker.patch('mozregression.launchers.zipfile') zipfile.ZipFile = Zipfile call = mocker.patch('mozregression.launchers.call') call.return_code = return_code logger = Mock() with launchers.JsShellLauncher('/path/to') as js: js._logger = logger js.start() assert js.get_app_info() == {} call.assert_called_once_with([js.binary], cwd=js.tempdir) logger.warning.calls == 0 if return_code else 1
def test_jsshell_install_except(mocker): mocker.patch('mozregression.launchers.zipfile').ZipFile.side_effect \ = Exception with pytest.raises(Exception): launchers.JsShellLauncher('/path/to')