def METHOD_NAME():
    """
    Test that when selftest is called and a selftest function fails or raises an exception
    that the program exits and gives an error code of 1
    """
    app_configs = helpers.get_configs(path_config_file=mock_paths.MOCK_APP_CONFIG, ALLOW_UNRECOGNIZED=True)
    with pytest.raises(SystemExit) as pytest_wrapped_e:
        parser = Namespace(install_list=['test'], project_name=['test'])
        with patch("resilient_circuits.cmds.selftest.pkg_resources.iter_entry_points", create=True) as mocked_entrypoints:
            mocked_entrypoints.return_value = MOCKED_SELFTEST_ENTRYPOINTS
            selftest.run_apps_selftest(parser, app_configs)
    assert pytest_wrapped_e.type == SystemExit
    assert pytest_wrapped_e.value.code == 1