Skip to content

Commit

Permalink
Merge pull request #6011 from wxtim/fix.sys-argv-cleaner
Browse files Browse the repository at this point in the history
Apply CLI clean changes to correct list
  • Loading branch information
oliver-sanders authored Mar 18, 2024
2 parents 024b4c2 + 7c41ee5 commit 2678b53
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions changes.d/6011.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed a `cylc vip` bug causing remote re-invocation to fail if using `--workflow-name` option.
4 changes: 2 additions & 2 deletions cylc/flow/option_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -878,9 +878,9 @@ def cleanup_sysargv(
new_args[1] = script_name

# replace source path with workflow ID.
if str(source) in sys.argv:
if str(source) in new_args:
new_args.remove(str(source))
if workflow_id not in sys.argv:
if workflow_id not in new_args:
new_args.append(workflow_id)

sys.argv = new_args
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/test_option_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,22 @@ def test_combine_options(inputs, expect):
'play --foo something myworkflow'.split(),
id='no path given'
),
param(
'vip -n myworkflow --no-run-name'.split(),
{
'script_name': 'play',
'workflow_id': 'myworkflow',
'compound_script_opts': [
OptionSettings(['--workflow-name', '-n']),
OptionSettings(['--no-run-name']),
],
'script_opts': [
OptionSettings(['--not-used']),
]
},
'play myworkflow'.split(),
id='workflow-id-added'
),
]
)
def test_cleanup_sysargv(monkeypatch, argv_before, kwargs, expect):
Expand Down

0 comments on commit 2678b53

Please sign in to comment.