def test_default_work():
    parser = AbsTask.get_parser()
    args = parser.parse_args([])
    resolve_distributed_mode(args)
    option = build_dataclass(DistributedOption, args)
    option.init_options()
    option.init_torch_distributed()
Exemple #2
0
def test_add_arguments(parser):
    AbsTask.get_parser()
Exemple #3
0
def test_print_config_and_load_it(tmp_path):
    config_file = tmp_path / "config.yaml"
    with config_file.open("w") as f:
        AbsTask.print_config(f)
    parser = AbsTask.get_parser()
    parser.parse_args(["--config", str(config_file)])
Exemple #4
0
def test_main_with_no_args():
    with pytest.raises(SystemExit):
        AbsTask.main(cmd=[])
Exemple #5
0
def test_main_print_config():
    with pytest.raises(SystemExit):
        AbsTask.main(cmd=["--print_config"])
Exemple #6
0
def test_main_help():
    with pytest.raises(SystemExit):
        AbsTask.main(cmd=["--help"])
Exemple #7
0
def test_add_arguments_help():
    parser = AbsTask.get_parser()
    with pytest.raises(SystemExit):
        parser.parse_args(["--help"])