Opened 3 years ago

Closed 3 years ago

#18926 closed Bug (duplicate)

Django test suite doesn't pass on Windows when checked out of git

Reported by: dlanger Owned by: nobody
Component: Uncategorized Version: 1.4
Severity: Normal Keywords:
Cc: jezdez Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

There are several tests in the Django test suite that are line-ending dependent - for example, regressiontests.admin_views.tests.AdminSearchTest, which asserts the presence of \n1 user\n (as well as a few others that have \n in their assertions). These test pass in environments that use LF as their default line ending.

Running Windows, git's default behaviour is to change LF line endings to CRLF when a file is loaded from the object database, and convert them back to LF when they're committed. This causes those tests to fail, since \n1 user\n isn't there - \r\n1 user\r\n is.

This can be fixed by adding a .gitattributes file to the root of the Django repo, which tells git clients how to handle those files. The one attached is minimal - it says to treat all HTML files as text, and to keep the line endings as LF for those files. See here for a post on cross-platform line endings and git, and the format of the .gitattributes file.

To reproduce, check out the root Django repo into a Windows environment using standard Windows git (eg. from GitHub) - downloading and extracting a tarball won't do the bad line-ending conversion - and run python runtests.py --settings=test_sqlite admin_views.

Tested on Windows7 x64, git 1.7.11, and HEAD of django:master.

Attachments (1)

.gitattributes (17 bytes) - added by dlanger 3 years ago.

Download all attachments as: .zip

Change History (3)

Changed 3 years ago by dlanger

comment:1 Changed 3 years ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Duplicate of #18920.

comment:2 Changed 3 years ago by claudep

  • Resolution set to duplicate
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.
Back to Top