Skip to content

Commit

Permalink
Fix the exception sink test error message check.
Browse files Browse the repository at this point in the history
On my M1 I get a different message than apparently
CI does.
  • Loading branch information
benjyw committed Mar 7, 2024
1 parent d2af94c commit 322e987
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/python/pants/base/exception_sink_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,31 +40,32 @@ def test_set_invalid_log_location():
"created"
) in str(exc.value)

# NB: This target is marked with 'platform_specific_behavior' because OSX errors out here at
# creating a new directory with safe_mkdir(), Linux errors out trying to create the directory
# NB: This target is marked with 'platform_specific_behavior' because OSX may error out here at
# creating a new directory with safe_mkdir(), while Linux errors out trying to create the directory
# for its log files with safe_open(). This may be due to differences in the filesystems.
# TODO: figure out why we error out at different points here!
with pytest.raises(ExceptionSink.ExceptionSinkError) as exc:
sink.reset_log_location("/")
err_str = {
Platform.macos_arm64: (
"The provided log location path at '/' is not writable or could not be created: "
"[Errno 21] Is a directory: '/'."
"[Errno 21] Is a directory: '/'.",
"Error opening fatal error log streams for log location '/': [Errno 30] Read-only file system",
),
Platform.macos_x86_64: (
"The provided log location path at '/' is not writable or could not be created: "
"[Errno 21] Is a directory: '/'."
"[Errno 21] Is a directory: '/'.",
),
Platform.linux_arm64: (
"Error opening fatal error log streams for log location '/': [Errno 13] Permission "
"denied:"
"denied:",
),
Platform.linux_x86_64: (
"Error opening fatal error log streams for log location '/': [Errno 13] Permission "
"denied:"
"denied:",
),
}
assert match(Platform.create_for_localhost(), err_str) in str(exc.value)
assert any([s in str(exc.value) for s in match(Platform.create_for_localhost(), err_str)])


def test_log_exception():
Expand Down

0 comments on commit 322e987

Please sign in to comment.