Skip to content

Commit d7ec33d

Browse files
committed
fix use of LoadFromOPSFile
1 parent f8d0db4 commit d7ec33d

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

‎paths_cli/tests/wizard/test_load_from_ops.py‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,11 @@ def ops_file_fixture():
4545
return storage
4646

4747
def test_named_objs_helper(ops_file_fixture):
48-
wizard = mock_wizard([])
4948
helper_func = named_objs_helper(ops_file_fixture, 'foo')
50-
helper_func(wizard, 'any')
51-
assert "what I found" in wizard.console.log_text
52-
assert "bar" in wizard.console.log_text
53-
assert "baz" in wizard.console.log_text
49+
result = helper_func('any')
50+
assert "what I found" in result
51+
assert "bar" in result
52+
assert "baz" in result
5453

5554
@pytest.mark.parametrize('with_failure', [False, True])
5655
def test_get_ops_storage(tmpdir, with_failure):

‎paths_cli/wizard/load_from_ops.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
from paths_cli.parameters import INPUT_FILE
22
from paths_cli.wizard.core import get_object
33
from paths_cli.wizard.standard_categories import CATEGORIES
4+
from paths_cli.wizard.helper import Helper
5+
from functools import partial
46

57
from paths_cli.wizard.errors import FILE_LOADING_ERROR_MSG
68
LABEL = "Load existing from OPS file"
79

810
def named_objs_helper(storage, store_name):
9-
def list_items(wizard, user_input):
11+
def list_items(user_input, context=None):
1012
store = getattr(storage, store_name)
1113
names = [obj for obj in store if obj.is_named]
1214
outstr = "\n".join(['* ' + obj.name for obj in names])
13-
wizard.say(f"Here's what I found:\n\n{outstr}")
15+
return f"Here's what I found:\n\n{outstr}"
1416

1517
return list_items
1618

19+
1720
@get_object
1821
def _get_ops_storage(wizard):
1922
filename = wizard.ask("What file can it be found in?",

‎paths_cli/wizard/wizard.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ def __init__(self, steps):
4848
def _patch(self): # no-cov
4949
import openpathsampling as paths
5050
from openpathsampling.experimental.storage import monkey_patch_all
51+
from paths_cli.param_core import StorageLoader
5152
if not self._patched:
5253
paths = monkey_patch_all(paths)
5354
paths.InterfaceSet.simstore = True
5455
self._patched = True
56+
StorageLoader.has_simstore_patch = True
5557

5658
def debug(content): # no-cov
5759
# debug does no pretty-printing

0 commit comments

Comments
 (0)