Exemple #1
0
def test_main_with_defaults_and_complete_config_list():
    with pytest.raises(SystemExit) as e:
        main(
            defaults_file=DEFAULTS,
            config_files=[PARAMS],
        )
    assert e.value.code == 0
Exemple #2
0
def test_main_with_no_config_files(monkeypatch):
    monkeypatch.setattr(
        'builtins.input',
        lambda description: USER_INPUT,
    )
    with pytest.raises(SystemExit) as e:
        main(config_files=None, )
    assert e.value.code == 0
Exemple #3
0
def test_main_with_default_args(monkeypatch):
    monkeypatch.setattr(
        'builtins.input',
        lambda description: USER_INPUT,
    )
    with pytest.raises(SystemExit) as e:
        main()
    assert e.value.code == 0
Exemple #4
0
def test_main_with_explicit_args(monkeypatch):
    monkeypatch.setattr(
        'builtins.input',
        lambda description: USER_INPUT,
    )
    with pytest.raises(SystemExit) as e:
        main(
            defaults_file=DEFAULTS,
            config_files=[CONFIG_FILE],
        )
    assert e.value.code == 0
Exemple #5
0
def test_main_with_corrupt_defaults():
    with pytest.raises(SystemExit) as e:
        main(defaults_file=CONFIG_FILE, )
    assert e.value.code == 1
Exemple #6
0
def test_main_with_config_str():
    with pytest.raises(SystemExit) as e:
        main(config_files=CONFIG_FILE, )
    assert e.value.code == 1