Beispiel #1
0
def test_start_new_hyperopt_no_arg(mocker):
    args = [
        "new-hyperopt",
    ]
    with pytest.raises(OperationalException,
                       match="`new-hyperopt` requires --hyperopt to be set."):
        start_new_hyperopt(get_args(args))
Beispiel #2
0
def test_start_new_hyperopt_DefaultHyperopt(mocker, caplog):
    args = [
        "new-hyperopt",
        "--hyperopt",
        "DefaultHyperopt"
    ]
    with pytest.raises(OperationalException,
                       match=r"DefaultHyperopt is not allowed as name\."):
        start_new_hyperopt(get_args(args))
Beispiel #3
0
def test_start_new_hyperopt(mocker, caplog):
    wt_mock = mocker.patch.object(Path, "write_text", MagicMock())
    mocker.patch.object(Path, "exists", MagicMock(return_value=False))

    args = ["new-hyperopt", "--hyperopt", "CoolNewhyperopt"]
    start_new_hyperopt(get_args(args))

    assert wt_mock.call_count == 1
    assert "CoolNewhyperopt" in wt_mock.call_args_list[0][0][0]
    assert log_has_re("Writing hyperopt to .*", caplog)
Beispiel #4
0
def test_start_new_hyperopt(mocker, caplog):
    wt_mock = mocker.patch.object(Path, "write_text", MagicMock())
    mocker.patch.object(Path, "exists", MagicMock(return_value=False))

    args = ["new-hyperopt", "--hyperopt", "CoolNewhyperopt"]
    start_new_hyperopt(get_args(args))

    assert wt_mock.call_count == 1
    assert "CoolNewhyperopt" in wt_mock.call_args_list[0][0][0]
    assert log_has_re("Writing hyperopt to .*", caplog)

    mocker.patch(
        'freqtrade.commands.deploy_commands.setup_utils_configuration')
    mocker.patch.object(Path, "exists", MagicMock(return_value=True))
    with pytest.raises(
            OperationalException,
            match=r".* already exists. Please choose another Hyperopt Name\."):
        start_new_hyperopt(get_args(args))