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 test verifying that line endings are maintained for read_file() #31

Merged
merged 1 commit into from
Jan 2, 2025

Conversation

craigwalton-dsit
Copy link
Collaborator

@craigwalton-dsit craigwalton-dsit commented Dec 19, 2024

There is a new requirement in Inspect's SandboxEnvironment.read_file()

When reading text files, implementations should preserve newline constructs (e.g. crlf should be preserved not converted to lf).

https://github.com/UKGovernmentBEIS/inspect_ai/blob/bcf7bd58d083073e79a078172887e08341211426/src/inspect_ai/util/_sandbox/environment.py#L205C1-L208C1

This was already the case for the K8s sandbox provider. I've just added a test to prevent any regressions now that this is documented.

The read_file() function should should preserve newline constructs (e.g. crlf should be preserved not converted to lf). This is equivalent to specifying newline="" in a call to the Python open() function.

@craigwalton-dsit craigwalton-dsit marked this pull request as ready for review December 20, 2024 09:53
@craigwalton-dsit craigwalton-dsit merged commit 603b653 into main Jan 2, 2025
5 checks passed
@craigwalton-dsit craigwalton-dsit deleted the craig/line-endings branch January 2, 2025 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants