def test_get_application_environment_raises_on_app_path_error(self):
     unknown_app_path = self.getUniqueString()
     with patch.object(_l,
                       'get_application_launcher_wrapper',
                       side_effect=RuntimeError()):
         self.assertThat(
             lambda: _get_application_environment(app_path=unknown_app_path
                                                  ),
             raises(
                 RuntimeError(
                     "Autopilot could not determine the correct introspection "
                     "type to use. You can specify this by providing app_type."
                 )))
 def test_get_application_environment_uses_app_path_argument(self):
     with patch.object(
             _l, 'get_application_launcher_wrapper') as patched_wrapper:
         _get_application_environment(app_path="app_path")
         patched_wrapper.assert_called_with("app_path")
 def test_get_application_environment_raises_runtime_with_no_args(self):
     self.assertThat(
         lambda: _get_application_environment(),
         raises(ValueError("Must specify either app_type or app_path.")))
 def test_get_application_environment_uses_app_type_argument(self):
     with patch.object(_l, '_get_app_env_from_string_hint') as from_hint:
         _get_application_environment(app_type="app_type")
         from_hint.assert_called_with("app_type")