diff --git a/src/installer/records.py b/src/installer/records.py index 9bb45c7..b0adf88 100644 --- a/src/installer/records.py +++ b/src/installer/records.py @@ -106,8 +106,7 @@ def to_row(self, path_prefix: str | None = None) -> tuple[str, str, str]: path = self.path # Convert Windows paths to use / for consistency - if os.sep == "\\": - path = path.replace("\\", "/") # pragma: no cover + path = path.replace("\\", "/") return ( path, diff --git a/tests/test_records.py b/tests/test_records.py index a681608..eee3aa9 100644 --- a/tests/test_records.py +++ b/tests/test_records.py @@ -176,6 +176,11 @@ def test_string_representation_with_prefix( ) assert record.to_row("prefix/") == expected_row + def test_to_row_normalizes_windows_path_on_any_platform(self): + record = RecordEntry.from_elements(r"package\module.py", "", "") + + assert record.to_row() == ("package/module.py", "", "") + def test_equality(self): record = RecordEntry.from_elements( "file.py",