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 16b00c5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ creating a new release entry be sure to copy & paste the span tag with the
updated. Only the first match gets replaced, so it's fine to leave the old
ones in. -->

-------------------------------------------------------------------------------
## __cylc-8.1.2 (<span actions:bind='release-date'>Coming Soon</span>)__

[#5349](https://github.com/cylc/cylc-flow/pull/5349) - Bugfix: `cylc vip --workflow-name`
only worked when used with a space, not an `=`.

-------------------------------------------------------------------------------
## __cylc-8.1.1 (<span actions:bind='release-date'>Released 2023-01-31</span>)__

Expand Down
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 16b00c5

Please sign in to comment.