Opened 4 months ago
Closed 4 months ago
#35504 closed Bug (invalid)
Bug running test i18n.test_extraction.UnchangedPoExtractionTests on WSL cause of CRLF/LF issue
Reported by: | gaweng | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Normal | Keywords: | PoExtraction, WSL, Test |
Cc: | gaweng | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Bug is only occurs in WSL.
Steps to reproduce:
- creating an venv
- cloning the repo and installing all dependencies
- run test i18n.test_extraction.UnchangedPoExtractionTests
Reason:
The failure is causing CRLF on Windows System but running the tests in WSL expecting LF, so the po file is regenerated and the date doesn't match.
Workaround:
You can change django.po.tmp file to LF Line endings, than tests run without errors.
Alternatively, you also can change the line ending to LF in git. But than it's also LF if you're using it in windows environment with powershell.
Error-Message:
.F ====================================================================== FAIL: test_po_remains_unchanged (i18n.test_extraction.UnchangedPoExtractionTests) PO files are unchanged unless there are new changes. ---------------------------------------------------------------------- Traceback (most recent call last): File "/mnt/c/git/contributing/django/tests/i18n/test_extraction.py", line 1086, in test_po_remains_unchanged self.assertEqual(po_contents, self.original_po_contents) AssertionError: '# SO[187 chars]R.\n# \n#, fuzzy\nmsgid ""\nmsgstr ""\n"Projec[580 chars]."\n' != '# SO[187 chars]R.\n#\n#, fuzzy\nmsgid ""\nmsgstr ""\n"Project[579 chars]."\n' Diff is 971 characters long. Set self.maxDiff to None to see it. ---------------------------------------------------------------------- Ran 2 tests in 0.159s
Comment on Error-Message:
The error message is only referring on the new generated po file, cause it doesn't looks equal for gettext cause of CRLF instead of LF
These tests work in Windows and I think running the Django test suite in WSL is quite niche and so I wouldn't track this with a ticket.
If you have a nice way to resolve this feel free to submit a PR 👍