Skip to content

Commit

Permalink
Review feedback RD
Browse files Browse the repository at this point in the history
  • Loading branch information
datamel committed Jul 20, 2021
1 parent 595495e commit 042d1b0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions cylc/flow/workflow_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ def is_installed(rund: Union[Path, str]) -> bool:
relation to the run directory.
Args:
rund (Union[Path, str]): run directory path to check
rund: run directory path to check
Returns:
bool: True if rund belongs to an installed workflow
Expand Down Expand Up @@ -1271,6 +1271,7 @@ def install_workflow(
rundir: for overriding the default cylc-run directory.
no_run_name: Flag as True to install workflow into
~/cylc-run/<flow_name>
cli_symlink_dirs: Symlink dirs, if entered on the cli.
Return:
source: The source directory.
Expand Down Expand Up @@ -1506,9 +1507,8 @@ def parse_cli_sym_dirs(symlink_dirs: str) -> Dict[str, Dict[str, Any]]:
"""Converts command line entered symlink dirs to a dictionary.
Args:
symlink_dirs (str): As entered by user on cli,
symlink_dirs: As entered by user on cli,
e.g. "log=$DIR, share=$DIR2".
fill_syms (bool): If True, will fill missing
Raises:
WorkflowFilesError: If directory to be symlinked is not in permitted
Expand All @@ -1526,9 +1526,10 @@ def parse_cli_sym_dirs(symlink_dirs: str) -> Dict[str, Dict[str, Any]]:
if symlink_dirs == "":
return symdict
symlist = symlink_dirs.strip(',').split(',')
possible_symlink_dirs = WorkflowFiles.SYMLINK_DIRS.symmetric_difference(
{'', WorkflowFiles.RUN_DIR}
possible_symlink_dirs = set(WorkflowFiles.SYMLINK_DIRS.union(
{WorkflowFiles.RUN_DIR})
)
possible_symlink_dirs.remove('')
for pair in symlist:
try:
key, val = pair.split("=")
Expand All @@ -1540,8 +1541,7 @@ def parse_cli_sym_dirs(symlink_dirs: str) -> Dict[str, Dict[str, Any]]:
'--symlink-dirs=\'log=$DIR, share=$DIR2, ...\''
)
if key not in possible_symlink_dirs:
dirs = str(
possible_symlink_dirs).lstrip('frozenset({').rstrip('})')
dirs = ', '.join(possible_symlink_dirs)
raise UserInputError(
f"{key} not a valid entry for --symlink-dirs. "
f"Configurable symlink dirs are: {dirs}"
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_workflow_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -1462,7 +1462,7 @@ def test_check_flow_file_symlink(
"'log=$DIR, share=$DIR2, ...'",
None
),
('run=$NICE, log= $Garibaldi, share/cycle=$RichTea', 'None',
('run=$NICE, log= $Garibaldi, share/cycle=$RichTea', None,
{'localhost': {
'run': '$NICE',
'log': '$Garibaldi',
Expand All @@ -1482,7 +1482,7 @@ def test_parse_cli_sym_dirs(
):
"""Test parse_cli_sym_dirs returns dict or correctly raises errors on cli
symlink dir options"""
if err_msg != 'None':
if err_msg is not None:
with pytest.raises(UserInputError) as exc:
parse_cli_sym_dirs(symlink_dirs)
assert(err_msg) in str(exc)
Expand Down

0 comments on commit 042d1b0

Please sign in to comment.