Skip to content

Commit

Permalink
add workflow_id to sysargv for play step if it isn't there
Browse files Browse the repository at this point in the history
  • Loading branch information
wxtim committed Nov 17, 2022
1 parent 5e81153 commit 48fc3ac
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
5 changes: 3 additions & 2 deletions cylc/flow/option_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from itertools import product
from optparse import (
OptionParser,
OptionConflictError,
Values,
Option,
IndentedHelpFormatter
Expand Down Expand Up @@ -689,7 +688,8 @@ def combine_options_pair(first_list, second_list):
`command-B has an option `-f` or `--fortran`` then
`command-A+B` will have options `--fortran` and `--file` but _not_
`-f`, which would be confusing.
- Arguments only apply to a single component of the compound CLI script.
- Arguments only apply to a single component of the compound CLI
script.
"""
output = []
Expand Down Expand Up @@ -814,6 +814,7 @@ def cleanup_sysargv(
# replace source path with workflow ID.
if str(source) in sys.argv:
sys.argv.remove(str(source))
if workflow_id not in sys.argv:
sys.argv.append(workflow_id)


Expand Down
17 changes: 16 additions & 1 deletion tests/unit/test_option_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,21 @@ def test_combine_options(inputs, expect):
'play --foo something myworkflow'.split(),
id='replace path'
),
param(
'vip --foo something'.split(),
{
'script_name': 'play',
'workflow_id': 'myworkflow',
'compound_script_opts': [
OptionSettings(['--foo', '-f'])],
'script_opts': [
OptionSettings(['--foo', '-f']),
],
'source': './myworkflow',
},
'play --foo something myworkflow'.split(),
id='no path given'
),
]
)
def test_cleanup_sysargv(monkeypatch, argv_before, kwargs, expect):
Expand Down Expand Up @@ -510,4 +525,4 @@ def test__in_list():
first = OptionSettings(['--foo'])
second = OptionSettings(['--foo'])
third = OptionSettings(['--bar'])
assert first._in_list([second, third]) == True
assert first._in_list([second, third]) is True

0 comments on commit 48fc3ac

Please sign in to comment.