Skip to content

Commit

Permalink
Fix a bug preventing cylc vip --workflow-name=foo from working.
Browse files Browse the repository at this point in the history
`--workflow-name foo` was fine.
Caused by removal of unwanted sys.argv for Cylc VIP not removing
items not exactly matching items in the Command line options arguments.
  • Loading branch information
wxtim committed Feb 7, 2023
1 parent ca9952a commit 3415bbe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cylc/flow/option_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,9 @@ def cleanup_sysargv(
not in ['store_true', 'store_false']
):
sys.argv.pop(index)
elif arg in [i.split('=')[0] for i in sys.argv]:
index = [i.split('=')[0] for i in sys.argv].index(arg)
sys.argv.pop(index)

# replace compound script name:
sys.argv[1] = script_name
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/test_option_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,19 @@ def test_combine_options(inputs, expect):
'play --foo something myworkflow'.split(),
id='no path given'
),
param(
'vip --bar=something'.split(),
{
'script_name': 'play',
'workflow_id': 'myworkflow',
'compound_script_opts': [
OptionSettings(['--bar', '-b'])],
'script_opts': [],
'source': './myworkflow',
},
'play myworkflow'.split(),
id='removes --key=value'
),
]
)
def test_cleanup_sysargv(monkeypatch, argv_before, kwargs, expect):
Expand Down

0 comments on commit 3415bbe

Please sign in to comment.