Example #1
0
def test_check_experiment_status_running():
    content = "RUNNING"
    error = ""
    with pytest.raises(TimeoutError) as excinfo:
        with patch(
                "requests.get",
                side_effect=lambda url: mocked_status_get(url, content, error),
        ):
            check_experiment_status(wait=0.1, max_retries=1)
    assert "check_experiment_status() timed out" == str(excinfo.value)
Example #2
0
def test_check_experiment_status_failed():
    content = "some_failed_status"
    error = "NNI_ERROR"
    with pytest.raises(RuntimeError) as excinfo:
        with patch(
                "requests.get",
                side_effect=lambda url: mocked_status_get(url, content, error),
        ):
            check_experiment_status(wait=0.1, max_retries=1)
    assert (
        "NNI experiment failed to complete with status some_failed_status - NNI_ERROR"
        == str(excinfo.value))
Example #3
0
def test_check_experiment_status_tuner_no_more_trial():
    content = "TUNER_NO_MORE_TRIAL"
    error = ""
    with patch("requests.get",
               side_effect=lambda url: mocked_status_get(url, content, error)):
        check_experiment_status(wait=0.1, max_retries=1)
Example #4
0
def test_check_experiment_status_done():
    content = "DONE"
    error = ""
    with patch("requests.get",
               side_effect=lambda url: mocked_status_get(url, content, error)):
        check_experiment_status(wait=0.1, max_retries=1)