コード例 #1
0
ファイル: test_config.py プロジェクト: gdurif/benchOpt
def test_config_file_permission_no_warning():
    with set_config_file() as config_file:
        with pytest.warns(None) as record:
            global_config_file = get_global_config_file()
        assert str(global_config_file) == str(config_file)
        assert len(record) == 0, (
            "A warning was issued while it should not have.\n"
            f"Warning is: {record[0]}")
コード例 #2
0
def config(ctx, benchmark, token=None, filename=None):
    ctx.ensure_object(dict)

    if benchmark is None:
        config = get_global_config_file()
    else:
        benchmark = Benchmark(benchmark)
        config = benchmark.get_config_file()
    if ctx.invoked_subcommand is None:
        print(f"Config file is: {config.resolve()}")

    ctx.obj['config'] = config
    ctx.obj['benchmark_name'] = benchmark.name if benchmark else None
コード例 #3
0
ファイル: test_config.py プロジェクト: gdurif/benchOpt
def test_config_file_permission_warn(permission):
    with set_config_file(permission) as config_file:
        msg = f"{config_file} is with mode {permission}"
        with pytest.warns(UserWarning, match=msg):
            global_config_file = get_global_config_file()
        assert str(global_config_file) == str(config_file)