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 1e57247
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cylc/flow/option_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,9 +814,11 @@ 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)



def log_subcommand(command, workflow_id):
"""Log a command run as part of a sequence.
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 1e57247

Please sign in to comment.