From 30c4230a3d856da11090753c482914a8036ef4c5 Mon Sep 17 00:00:00 2001 From: w3lld1 Date: Thu, 9 Jul 2026 16:35:47 +0000 Subject: [PATCH] fix: write exports with lf newlines --- src/poetry_plugin_export/exporter.py | 2 +- tests/test_exporter.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/poetry_plugin_export/exporter.py b/src/poetry_plugin_export/exporter.py index 1b82b30..68f69a4 100644 --- a/src/poetry_plugin_export/exporter.py +++ b/src/poetry_plugin_export/exporter.py @@ -102,7 +102,7 @@ def export(self, fmt: str, cwd: Path, output: IO | str) -> None: if isinstance(output, IO): output.write(content) else: - with (cwd / output).open("w", encoding="utf-8") as txt: + with (cwd / output).open("w", encoding="utf-8", newline="\n") as txt: txt.write(content) def _export_generic_txt( diff --git a/tests/test_exporter.py b/tests/test_exporter.py index b56c976..d795765 100644 --- a/tests/test_exporter.py +++ b/tests/test_exporter.py @@ -157,6 +157,8 @@ def test_exporter_can_export_requirements_txt_with_standard_packages( exporter = Exporter(poetry, NullIO()) exporter.export("requirements.txt", tmp_path, "requirements.txt") + assert b"\r\n" not in (tmp_path / "requirements.txt").read_bytes() + with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read()