Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug preventing cylc vip --workflow-name=foo from working. #5349

Merged
merged 4 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ ones in. -->

### Fixes

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

[#5367](https://github.com/cylc/cylc-flow/pull/5367) - Enable using
Rose options (`-O`, `-S` & `-D`) with `cylc view`.

Expand Down
4 changes: 4 additions & 0 deletions cylc/flow/option_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,7 @@ def cleanup_sysargv(
for x in compound_script_opts
}
# Filter out non-cylc-play options.
args = [i.split('=')[0] for i in sys.argv]
for unwanted_opt in (set(options.__dict__)) - set(script_opts_by_dest):
for arg in compound_opts_by_dest[unwanted_opt].args:
if arg in sys.argv:
Expand All @@ -831,6 +832,9 @@ def cleanup_sysargv(
not in ['store_true', 'store_false']
):
sys.argv.pop(index)
elif arg in args:
index = args.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