diff --git a/alfalfa_client/alfalfa_client.py b/alfalfa_client/alfalfa_client.py index a36c47d..8ca7b52 100644 --- a/alfalfa_client/alfalfa_client.py +++ b/alfalfa_client/alfalfa_client.py @@ -138,7 +138,7 @@ def wait(self, run_id: Union[RunID, List[RunID]], desired_status: str, timeout: if current_status != previous_status: print("Desired status: {}\t\tCurrent status: {}".format(desired_status, current_status)) previous_status = current_status - if current_status == desired_status.upper(): + if current_status == desired_status: return sleep(2) raise AlfalfaClientException(f"'wait' timed out waiting for status: '{desired_status}', current status: '{current_status}'") diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 333588f..f01eddc 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -39,7 +39,7 @@ def run_id(client: AlfalfaClient, model_path: Path): yield run_id status = client.status(run_id) - if status == "RUNNING": + if status == "running": client.stop(run_id) diff --git a/tests/integration/test_single_model.py b/tests/integration/test_single_model.py index 70d3de6..429ca4a 100644 --- a/tests/integration/test_single_model.py +++ b/tests/integration/test_single_model.py @@ -15,7 +15,7 @@ def test_advance(client: AlfalfaClient, external_clock_run_id: str): @pytest.mark.integration def test_status(client: AlfalfaClient, internal_clock_run_id: str): - assert client.status(internal_clock_run_id) == "RUNNING" + assert client.status(internal_clock_run_id) == "running" @pytest.mark.integration @@ -39,7 +39,7 @@ def test_output(client: AlfalfaClient, internal_clock_run_id: str): @pytest.mark.integration def test_stop(client: AlfalfaClient, internal_clock_run_id: str): client.stop(internal_clock_run_id) - assert client.status(internal_clock_run_id) == "COMPLETE" + assert client.status(internal_clock_run_id) == "complete" @pytest.mark.integration diff --git a/tests/integration/test_small_office.py b/tests/integration/test_small_office.py index 59dc36c..a2639ac 100644 --- a/tests/integration/test_small_office.py +++ b/tests/integration/test_small_office.py @@ -8,38 +8,38 @@ @pytest.mark.integration def test_basic_io(): alfalfa = AlfalfaClient(host='http://localhost') - run_id = alfalfa.submit('tests/integration/models/small_office') + model_id = alfalfa.submit('tests/integration/models/small_office') - alfalfa.wait(run_id, "ready") + alfalfa.wait(model_id, "ready") alfalfa.start( - run_id, + model_id, external_clock=True, start_datetime=datetime(2019, 1, 2, 0, 2, 0), end_datetime=datetime(2019, 1, 3, 0, 0, 0) ) - alfalfa.wait(run_id, "running") + alfalfa.wait(model_id, "running") - inputs = alfalfa.get_inputs(run_id) + inputs = alfalfa.get_inputs(model_id) assert "Test_Point_1" in inputs, "Test_Point_1 is in input points" inputs = {} inputs["Test_Point_1"] = 12 - alfalfa.set_inputs(run_id, inputs) + alfalfa.set_inputs(model_id, inputs) - outputs = alfalfa.get_outputs(run_id) + outputs = alfalfa.get_outputs(model_id) assert "Test_Point_1" in outputs.keys(), "Echo point for Test_Point_1 is not in outputs" # -- Advance a single time step - alfalfa.advance(run_id) + alfalfa.advance(model_id) - outputs = alfalfa.get_outputs(run_id) + outputs = alfalfa.get_outputs(model_id) assert pytest.approx(12) == outputs["Test_Point_1"], "Test_Point_1 value has not been processed by the model" # Shut down - alfalfa.stop(run_id) - alfalfa.wait(run_id, "complete") + alfalfa.stop(model_id) + alfalfa.wait(model_id, "complete") @pytest.mark.integration @@ -52,7 +52,7 @@ def test_many_model_operations(): run_ids = alfalfa.submit(model_path=model_paths) for run_id in run_ids: - assert alfalfa.status(run_id) == "READY", "Run has incorrect status" + assert alfalfa.status(run_id) == "ready", "Run has incorrect status" # Start Runs start_datetime = datetime(2022, 1, 1, 0, 0) @@ -62,7 +62,7 @@ def test_many_model_operations(): external_clock=True) for run_id in run_ids: - assert alfalfa.status(run_id) == "RUNNING", "Run has incorrect status" + assert alfalfa.status(run_id) == "running", "Run has incorrect status" # Advance Runs sim_datetime = start_datetime @@ -77,4 +77,4 @@ def test_many_model_operations(): alfalfa.stop(run_ids) for run_id in run_ids: - assert alfalfa.status(run_id) == "COMPLETE", "Run has incorrect status" + assert alfalfa.status(run_id) == "complete", "Run has incorrect status"