コード例 #1
0
def test_check_experiment_status_no_more_trial():
    content = "NO_MORE_TRIAL"
    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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #5
0
def test_check_experiment_status_failed():
    content = {'status': 'some_failed_status'}
    with pytest.raises(RuntimeError) as excinfo:
        with patch('requests.get', side_effect=lambda url: mocked_status_get(url, content)):
            check_experiment_status(wait=0.1, max_retries=1)
    assert "NNI experiment failed to complete with status some_failed_status" == str(excinfo.value)
コード例 #6
0
def test_check_experiment_status_no_more_trial():
    content = {'status': 'NO_MORE_TRIAL'}
    with pytest.raises(TimeoutError) as excinfo:
        with patch('requests.get', side_effect=lambda url: mocked_status_get(url, content)):
            check_experiment_status(wait=0.1, max_retries=1)
    assert "check_experiment_status() timed out" == str(excinfo.value)
コード例 #7
0
def test_check_experiment_status_running():
    content = {'status': 'RUNNING'}
    with pytest.raises(TimeoutError) as excinfo:
        with patch('requests.get', side_effect=lambda url: mocked_status_get(url, content)):
            check_experiment_status(wait=0.1, max_retries=1)
    assert "check_experiment_status() timed out" == str(excinfo.value)
コード例 #8
0
def test_check_experiment_status_tuner_no_more_trial():
    content = {'status': 'TUNER_NO_MORE_TRIAL'}
    with patch('requests.get', side_effect=lambda url: mocked_status_get(url, content)):
        check_experiment_status(wait=0.1, max_retries=1)
コード例 #9
0
def test_check_experiment_status_done():
    content = {'status': 'DONE'}
    with patch('requests.get', side_effect=lambda url: mocked_status_get(url, content)):
        check_experiment_status(wait=0.1, max_retries=1)