|
1 | 1 | import os
|
2 | 2 | import time
|
3 | 3 | from datetime import datetime, timezone
|
| 4 | +from typing import Any |
4 | 5 |
|
5 | 6 | import pytest
|
6 | 7 | import yaml
|
@@ -40,7 +41,9 @@ def basic_engine():
|
40 | 41 | print("Stopped")
|
41 | 42 |
|
42 | 43 |
|
43 |
| -def start_workflow(md, da, workflow_file_name, variables) -> str: |
| 44 | +def start_workflow( |
| 45 | + md, da, workflow_file_name: str, variables: dict[str, Any] | None = None |
| 46 | +) -> str: |
44 | 47 | """A convenience function to handle all the 'START' logic for a workflow.
|
45 | 48 | It is given the message dispatcher, data adapter, and the base-name of the
|
46 | 49 | workflow definition - i.e. the filename without the '.yaml' extension
|
@@ -177,9 +180,37 @@ def test_workflow_engine_example_smiles_to_file(basic_engine):
|
177 | 180 | # Additional, detailed checks...
|
178 | 181 | # Check we only have one RunningWorkflowStep, and it succeeded
|
179 | 182 | response = da.get_running_workflow_steps(running_workflow_id=r_wfid)
|
180 |
| - print(f"^^^^^^ response={response}") |
181 | 183 | assert response["count"] == 1
|
182 | 184 | assert response["running_workflow_steps"][0]["done"]
|
183 | 185 | assert response["running_workflow_steps"][0]["success"]
|
184 | 186 | # This test should generate a file in the simulated project directory
|
185 | 187 | assert project_file_exists(output_file)
|
| 188 | + |
| 189 | + |
| 190 | +@pytest.mark.skip(reason="The engine does not currently create the required variables") |
| 191 | +def test_workflow_engine_shortcut_example_1(basic_engine): |
| 192 | + # Arrange |
| 193 | + da, md = basic_engine |
| 194 | + # Make sure files that should be generated by the test |
| 195 | + # do not exist before we run the test. |
| 196 | + output_file_a = "a.sdf" |
| 197 | + assert not project_file_exists(output_file_a) |
| 198 | + output_file_b = "b.sdf" |
| 199 | + assert not project_file_exists(output_file_b) |
| 200 | + |
| 201 | + # Act |
| 202 | + r_wfid = start_workflow(md, da, "shortcut-example-1", {}) |
| 203 | + |
| 204 | + # Assert |
| 205 | + wait_for_workflow(da, r_wfid) |
| 206 | + # Additional, detailed checks... |
| 207 | + # Check we only have one RunningWorkflowStep, and it succeeded |
| 208 | + response = da.get_running_workflow_steps(running_workflow_id=r_wfid) |
| 209 | + assert response["count"] == 2 |
| 210 | + assert response["running_workflow_steps"][0]["done"] |
| 211 | + assert response["running_workflow_steps"][0]["success"] |
| 212 | + assert response["running_workflow_steps"][1]["done"] |
| 213 | + assert response["running_workflow_steps"][1]["success"] |
| 214 | + # This test should generate a file in the simulated project directory |
| 215 | + assert project_file_exists(output_file_a) |
| 216 | + assert project_file_exists(output_file_b) |
0 commit comments