Ejemplo n.º 1
0
 def _call(cls: Type[Handler], args: argparse.Namespace, architecture: str) -> bool:
     """
     additional function to wrap all calls for multiprocessing library
     :param args: command line args
     :param architecture: repository architecture
     :return: True on success, False otherwise
     """
     try:
         configuration = Configuration.from_path(args.configuration, architecture, not args.no_log)
         with Lock(args, architecture, configuration):
             cls.run(args, architecture, configuration)
         return True
     except Exception:
         logging.getLogger("root").exception("process exception")
         return False
Ejemplo n.º 2
0
def test_from_path(mocker: MockerFixture) -> None:
    """
    must load configuration
    """
    read_mock = mocker.patch("configparser.RawConfigParser.read")
    load_includes_mock = mocker.patch(
        "ahriman.core.configuration.Configuration.load_includes")
    load_logging_mock = mocker.patch(
        "ahriman.core.configuration.Configuration.load_logging")
    path = Path("path")

    configuration = Configuration.from_path(path, "x86_64", True)
    assert configuration.path == path
    read_mock.assert_called_with(path)
    load_includes_mock.assert_called_once()
    load_logging_mock.assert_called_once()
Ejemplo n.º 3
0
def configuration(resource_path_root: Path) -> Configuration:
    path = resource_path_root / "core" / "ahriman.ini"
    return Configuration.from_path(path=path,
                                   architecture="x86_64",
                                   logfile=False)