示例#1
0
def test_invalid_config(path_args: Dict[str, pathlib.Path]):
    evtloop = EventLoop()
    args = {
        'config_file': str(path_args['moonraker.conf']),
        'log_file': "",
        'software_version': "moonraker-pytest"
    }
    with pytest.raises(ConfigError):
        Server(args, None, evtloop)
示例#2
0
def test_config_and_log_warnings(path_args: Dict[str, pathlib.Path]):
    evtloop = EventLoop()
    args = {
        'config_file': str(path_args['moonraker.conf']),
        'log_file': "",
        'software_version': "moonraker-pytest",
        'log_warning': "Log Warning Test",
        'config_warning': "Config Warning Test"
    }
    expected = ["Log Warning Test", "Config Warning Test"]
    server = Server(args, None, evtloop)
    assert server.warnings == expected
示例#3
0
def base_server(path_args: Dict[str, pathlib.Path],
                event_loop: asyncio.AbstractEventLoop) -> Iterator[Server]:
    evtloop = EventLoop()
    args = {
        'config_file': str(path_args['moonraker.conf']),
        'log_file': str(path_args.get("moonraker.log", "")),
        'software_version': "moonraker-pytest"
    }
    ql = logger = None
    if args["log_file"]:
        ql, logger, warning = utils.setup_logging(args)
        if warning:
            args["log_warning"] = warning
    yield Server(args, logger, evtloop)
    if ql is not None:
        ql.stop()