Skip to content

Fix test_edit to work with BSD sed - #3129

Merged
Rowlando13 merged 4 commits into
pallets:stablefrom
mtelka:test_edit
Oct 29, 2025
Merged

Rowlando13 merged 4 commits into
pallets:stablefrom
mtelka:test_edit

Conversation

@mtelka

@mtelka mtelka commented Oct 27, 2025

Copy link
Copy Markdown
Contributor

Fixes #3128.

@Rowlando13

Copy link
Copy Markdown
Member

Please add a comment.

@mtelka

mtelka commented Oct 28, 2025

Copy link
Copy Markdown
Contributor Author

Please add a comment.

@Rowlando13 could you please elaborate what kind of comment you mean? Thank you.

@Rowlando13

Copy link
Copy Markdown
Member

Explain in short why the test was altered. Specifically note the os and reason. If you don't we may unintentionally break the test again or add a similar breaking test.

@mtelka

mtelka commented Oct 28, 2025 •

Copy link
Copy Markdown
Contributor Author

Explain in short why the test was altered. Specifically note the os and reason. If you don't we may unintentionally break the test again or add a similar breaking test.

Here in the PR, or in the sources?

@Rowlando13

Copy link
Copy Markdown
Member

If by sources you mean in tests/test_termui.py, then yes.

@mtelka

mtelka commented Oct 29, 2025

Copy link
Copy Markdown
Contributor Author

If by sources you mean in tests/test_termui.py, then yes.

Okay, will do.

In the meantime, POSIX says this about sed:

In default operation, sed cyclically shall append a line of input, less its 
terminating <newline> character, into the pattern space. Reading from input
shall be skipped if a <newline> was in the pattern space prior to a D command 
ending the previous cycle. The sed utility shall then apply in sequence all 
commands whose addresses select that pattern space, until a command starts the
next cycle or quits. If no commands explicitly started a new cycle, then at the
end of the script the pattern space shall be copied to standard output (except
when -n is specified) and the pattern space shall be deleted. Whenever the
pattern space is written to standard output or a named file, sed shall
immediately follow it with a <newline>.

So it looks like GNU sed does not follow this accurately.

@mtelka

mtelka commented Oct 29, 2025

Copy link
Copy Markdown
Contributor Author

Please add a comment.

Done. @Rowlando13 please let me know if you'd prefer different wording there. Thank you.

@Rowlando13
Rowlando13 changed the base branch from main to stable October 29, 2025 23:32
@Rowlando13
Rowlando13 merged commit a92c573 into pallets:stable Oct 29, 2025
@mtelka
mtelka deleted the test_edit branch October 30, 2025 05:42
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 14, 2025
@kdeldycke kdeldycke added this to the 8.3.1 milestone Aug 8, 2026
@kdeldycke kdeldycke added the tests Click's own test suite and CI workflows label Aug 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

tests Click's own test suite and CI workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_edit fails with BSD sed

3 participants