Skip to content

Commit 332fef0

Browse files
Merge pull request #124 from wfcommons/testing
WfChef Testing++
2 parents 1d82eb9 + be42fea commit 332fef0

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

tests/wfchef/test_wfchef.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import sys
1717

1818
from tests.test_helpers import _create_fresh_local_dir
19+
from wfcommons.wfchef.chef import get_recipe
1920
from wfcommons.wfchef.chef import create_recipe
2021
from wfcommons.wfchef.chef import install_recipe
2122
from wfcommons.wfchef.chef import uninstall_recipe
@@ -123,6 +124,14 @@ def test_recipe_management_functions(self) -> None:
123124
sys.stderr.write(f"✗ Failed to use installed recipe: {e}\n")
124125
raise
125126

127+
try:
128+
recipe = get_recipe("somename_recipe")
129+
generator = WorkflowGenerator(recipe.from_num_tasks(250))
130+
except Exception as e:
131+
sys.stderr.write(f"✗ Failed to use get installed recipe by name: {e}\n")
132+
raise
133+
134+
sys.stderr.write("✓ Successfully used recipe via direct import and by using get_recipe(name)\n")
126135

127136
# Uninstall the recipe
128137
sys.stderr.write("\n" + "=" * 60 + "\n")

wfcommons/wfchef/chef.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
import traceback
2424
import sys
2525

26-
from typing import Dict, Optional, Union
26+
from typing import Dict, Optional, Union, Type
2727
from stringcase import capitalcase
28+
from wfcommons.wfchef.wfchef_abstract_recipe import WfChefWorkflowRecipe
2829

2930
from .duplicate import duplicate, NoMicrostructuresError
3031
from .find_microstructures import save_microstructures
@@ -166,7 +167,7 @@ def analyzer_summary(path_to_instances: pathlib.Path) -> Dict:
166167
return stats_dict
167168

168169

169-
def get_recipe(recipe: str) -> Optional[type]:
170+
def get_recipe(recipe: str) -> Type[WfChefWorkflowRecipe] | None:
170171
"""
171172
Load a recipe by name from installed entry points.
172173

0 commit comments

Comments
 (0)