Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#24193 closed Bug (fixed)

Test failure: deprecation.tests.DeprecatedChineseLanguageCodes.test_deprecation_warning with unexpected warnings about unclosed files

Reported by: Raphaël Hertzog Owned by: Claude Paroz <claude@…>
Component: Core (Other) Version: 1.7
Severity: Release blocker Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Trying to build 1.7.3 on Debian unstable, the package build fails when running the test suite with Python 3.4 (version 3.4.2-4).

FAIL: test_deprecation_warning (deprecation.tests.DeprecatedChineseLanguageCodes)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/«PKGBUILDDIR»/tests/deprecation/tests.py", line 206, in test_deprecation_warning
    "The use of the language code 'zh-tw' is deprecated. "
AssertionError: Lists differ: ["The[93 chars].", "unclosed file <_io.FileIO name='/build/py[317 chars]ad."] != ["The[93 chars].", "The use of the language code 'zh-tw' is d[53 chars]ad."]

First differing element 1:
unclosed file <_io.FileIO name='/«PKGBUILDDIR»/tests/view_tests/media/long-line.txt' mode='rb'>
The use of the language code 'zh-tw' is deprecated. Please use the 'zh-hant' translation instead.

First list contains 2 additional elements.
First extra element 2:
unclosed file <_io.FileIO name='/«PKGBUILDDIR»/tests/view_tests/media/long-line.txt' mode='rb'>

  ["The use of the language code 'zh-cn' is deprecated. Please use the "
   "'zh-hans' translation instead.",
-  'unclosed file <_io.FileIO '
-  "name='/«PKGBUILDDIR»/tests/view_tests/media/long-line.txt' "
-  "mode='rb'>",
-  'unclosed file <_io.FileIO '
-  "name='/«PKGBUILDDIR»/tests/view_tests/media/long-line.txt' "
-  "mode='rb'>",
   "The use of the language code 'zh-tw' is deprecated. Please use the "
   "'zh-hant' translation instead."]

Change History (9)

comment:1 Changed 3 years ago by Raphaël Hertzog

FWIW, this is blocking the upload of Django 1.7.3 to unstable and thus upcoming Debian 8 and it looks like it has been introduced by the recent security fix: 818e59a3f0fbadf6c447754d202d88df025f8f2a

comment:2 Changed 3 years ago by Tim Graham

Owner: changed from nobody to Tim Graham
Status: newassigned
Triage Stage: UnreviewedAccepted

comment:3 Changed 3 years ago by Claude Paroz

Has patch: set

Suggested fix: https://github.com/django/django/pull/3965
Note that versions after 1.7 are not affected as they introduced FileResponse which alleviates this issue.

comment:4 Changed 3 years ago by Brian May

"Note that versions after 1.7 are not affected" - are you sure you typed that correctly? This was version 1.7.3 that was affected. I suspect you meant to say 1.8, not 1.7?

comment:5 Changed 3 years ago by Tim Graham

Owner: Tim Graham deleted
Status: assignednew

Claude meant the stable/1.7.x branch (the 1.8 branch is not affected). This will be fixed in the 1.7.4 release.

comment:6 Changed 3 years ago by Tim Graham

Component: UncategorizedCore (Other)
Triage Stage: AcceptedReady for checkin

comment:7 Changed 3 years ago by Claude Paroz <claude@…>

Owner: set to Claude Paroz <claude@…>
Resolution: fixed
Status: newclosed

In b1bf8d64fbadcab860eb98662c49b8db33db0c3c:

[1.7.x] Fixed #24193 -- Prevented unclosed file warnings in static.serve()

This regression was caused by 818e59a3f0. The patch is a partial
backport of the new FileResponse class available in later Django
versions.
Thanks Raphaël Hertzog for the report, and Tim Graham and Collin
Anderson for the reviews.

comment:8 Changed 3 years ago by Claude Paroz <claude@…>

In bc93568500303b4fa00c89c7f1607fab455b6c32:

[1.8.x] Fixed warning leak in static.serve() test

Partial forward port of b1bf8d64fb from 1.7.x. Refs #24193.

comment:9 Changed 3 years ago by Claude Paroz <claude@…>

In f8e4e4a935512aedf815f6aee85bc797b498ea75:

Fixed warning leak in static.serve() test

Partial forward port of b1bf8d64fb from 1.7.x. Refs #24193.

Note: See TracTickets for help on using tickets.
Back to Top