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

Add support to logging directory setup for no verb #655

Merged
merged 1 commit into from
Jul 25, 2024
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
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
Loading