Skip to content

Commit

Permalink
Merge branch 'master' into cottsay/default-verb
Browse files Browse the repository at this point in the history
  • Loading branch information
cottsay committed Jul 25, 2024
2 parents ecd8267 + 5c56e00 commit 69c5ee0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
4 changes: 3 additions & 1 deletion colcon_core/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,9 @@ def create_subparser(parser, cmd_name, verb_extensions, *, attribute):
title=f'{cmd_name} verbs',
description='\n'.join(verbs) or None,
dest=attribute,
help=f'call `{cmd_name} VERB -h` for specific help' if verbs else None,
help=(
f'call `{cmd_name} VERB -h` for specific help' if
verbs else argparse.SUPPRESS),
)
return subparser

Expand Down
11 changes: 7 additions & 4 deletions colcon_core/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,13 @@ def create_log_path(verb_name):
ignore_marker.touch()

# create latest symlinks
_create_symlink(path, path.parent / f'latest_{verb_name}')
_create_symlink(
path.parent / f'latest_{verb_name}',
path.parent / 'latest')
if verb_name is None:
_create_symlink(path, path.parent / 'latest')
else:
_create_symlink(path, path.parent / f'latest_{verb_name}')
_create_symlink(
path.parent / f'latest_{verb_name}',
path.parent / 'latest')


def _reset_log_path_creation_global():
Expand Down
11 changes: 11 additions & 0 deletions test/test_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,17 @@ def test_create_log_path(reset_log_path_creation_global):
assert (log_path / subdirectory).exists()
assert not (log_path / 'latest').is_symlink()

# check that `latest_verb` is skipped when there is no verb
(log_path / subdirectory).rmdir()
(log_path / 'latest').rmdir()
(log_path / 'latest_verb').unlink()
location._create_log_path_called = False
create_log_path(None)
assert (log_path / subdirectory).exists()
assert (log_path / 'latest').is_symlink()
assert (log_path / 'latest').resolve() == \
(log_path / subdirectory).resolve()


def test__create_symlink():
# check cases where functions raise exceptions and ensure it is being
Expand Down

0 comments on commit 69c5ee0

Please sign in to comment.