Skip to content

test_patch fails on Windows due to CRLF line ending mismatch #12

Description

@sumit1kr

Bug

tests/helpdesk/test_patch.py::TestMitigationPatch::test_applies_and_reverses_cleanly
fails on Windows because git apply converts LF to CRLF, causing a byte-level
mismatch when the test compares the reversed patch against the original file.

Reproduction

Windows 11, Python 3.13.5, Git with default core.autocrlf=true:

uv sync
uv run pytest tests/helpdesk/test_patch.py -v

Output: AssertionError: assert b'# Copyright...\r\n )\r\n' == b'# Copyright...rd],\n )\n'
At index 38 diff: b'\r' != b'\n'

Proposed fix

Add to .gitattributes: helpdesk-bot/mitigation.patch text eol=lf

Environment

  • OS: Windows 11
  • Python: 3.13.5
  • Git: default autocrlf settings

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions