Skip to content

Commit

Permalink
Fixed #388. Bug was due to a break rather than continue in Manifest
Browse files Browse the repository at this point in the history
setup. Links for other mainfests weren't created if scaninputs=True.

Modified existing test to trigger error. Test now passes.
  • Loading branch information
aidanheerdegen committed Nov 29, 2023
1 parent 9523ae3 commit ae7f283
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion payu/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def setup(self):
if self.have_manifest[mf]:
# Don't make links for inputs when scaninputs is True
if mf == 'input' and self.scaninputs:
break
continue
print('Making {} links'.format(mf))
self.manifests[mf].make_links()
else:
Expand Down
12 changes: 10 additions & 2 deletions test/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,20 @@ def test_exe_reproduce():

# Set reproduce exe to True
config['manifest']['reproduce']['exe'] = True
# Also set scaninputs to True to catch bug #388
config['manifest']['scaninputs'] = True
write_config(config)
manifests = get_manifests(ctrldir/'manifests')

# Run setup with unchanged exe but reproduce exe set to True.
# Should run without error
payu_setup(lab_path=str(labdir))

local_exe_path = list(manifests['exe.yaml'].keys())[0]

assert(manifests == get_manifests(ctrldir/'manifests'))
assert( (ctrldir / local_exe_path).exists() )
assert( Path(manifests['exe.yaml'][local_exe_path]['fullpath']) == (ctrldir / local_exe_path).resolve() )

bindir = labdir / 'bin'
exe = config['exe']
Expand Down Expand Up @@ -222,6 +228,8 @@ def test_input_reproduce():
# Set reproduce input to True
config['manifest']['reproduce']['exe'] = False
config['manifest']['reproduce']['input'] = True
# Set back to false
config['manifest']['scaninputs'] = False
config['exe'] = config_orig['exe']
write_config(config)
manifests = get_manifests(ctrldir/'manifests')
Expand Down Expand Up @@ -266,8 +274,8 @@ def test_input_reproduce():
with pytest.raises(SystemExit) as pytest_wrapped_e:
payu_setup(lab_path=str(labdir))

assert pytest_wrapped_e.type == SystemExit
assert pytest_wrapped_e.value.code == 1
assert pytest_wrapped_e.type == SystemExit
assert pytest_wrapped_e.value.code == 1

# Change reproduce input back to False
config['manifest']['reproduce']['input'] = False
Expand Down

0 comments on commit ae7f283

Please sign in to comment.