Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#26687 closed Bug (fixed)

i18n symlinked .po test: Fix assertion which is wrong for Windows

Reported by: Ramiro Morales Owned by: Ramiro Morales
Component: Internationalization Version: dev
Severity: Normal Keywords: windows i18n symlink os.symlink
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

On currently supoorted Python 3.x versions, the i18n.test_extraction.SymlinkExtractorTests.test_symlink test case fails when run on Windows with:

[00:08:26] ======================================================================
[00:08:26] FAIL: test_symlink (i18n.test_extraction.SymlinkExtractorTests)
[00:08:26] ----------------------------------------------------------------------
[00:08:26] Traceback (most recent call last):
[00:08:26]   File "C:\projects\django\tests\i18n\test_extraction.py", line 557, in test_symlink
[00:08:26] AssertionError: 'templates_symlinked/test.html' not found in '# SOME DESCRIPTIV
[00:08:26] E TITLE.\n# Copyright (C) YEAR THE PACKAGE\'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.\n#\n#, fuzzy\nmsgid ""\nmsgstr ""\n"Project-Id-Version: PACKAGE VERSION\\n"\n"Report-Msgid-Bugs-To: \\n"\n"POT-Creation-Date: 2016-05-30 09:33+0000\\n"\n"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n"\n"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n"\n"Language-Team: LANGUAGE <LL@li.org>\\n"\n"Language: \\n"\n"MIME-Version: 1.0\\n"\n"Content-Type: text/plain; charset=UTF-8\\n"\n"Content-Transfer-Encoding: 8bit\\n"\n"Plural-Forms: nplurals=2; plural=(n != 1);\\n"\n\n#. Translators: This comment should be extracted\n#: .\\__init__.py:4\nmsgid "This is a translatable string."\nmsgstr ""\n\n#: .\\__init__.py:7\nmsgid "This is another translatable string."\nmsgstr ""\n\n#: .\\__init__.py:12\n#, python-format\nmsgid "%(number)s Foo"\nmsgid_plural "%(number)s Foos"\nmsgstr[0] ""\nmsgstr[1] ""\n\n#: .\\__init__.py:14\nmsgid "Size"\nmsgstr ""\n\n#.
[00:08:26]  Translators: Django comment block for translators\n#. string\'s meaning unveiled\n#: .\\__init__.py:17 .\\templates\\test.html:5 .\\templates\\test.html:76\n#: .\\templates_symlinked\\test.html:5 .\\templates_symlinked\\test.html:76\nmsgid "This literal should be 
...

This is easily fixable by replacing the assert, as we already do in other test cases, to check for a PO location comment that can have non-Unix path separators.

This was uncovered by running our tests on Appveyor:

https://ci.appveyor.com/project/ramiro/django/build/34/job/6e9dawga1awks006#L105

Because there they are run as the Windows Administrator account (one of the conditions necessary to actually reach the assert for this platform), something which usually doesn't happen on a developer workstation.

Change History (7)

comment:1 by Ramiro Morales, 8 years ago

Has patch: set

comment:2 by Tim Graham, 8 years ago

Triage Stage: AcceptedReady for checkin

comment:3 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: newclosed

In e3877c53:

Fixed #26687 -- Made an i18n test not use a hardcoded path separator.

Fixed a failure on Windows.

comment:4 by Tim Graham <timograham@…>, 8 years ago

In c0a1e198:

[1.8.x] Fixed #26687 -- Made an i18n test not use a hardcoded path separator.

Fixed a failure on Windows.

Backport of e3877c53edb33271b0f31d20e60a924848692026 from master

comment:5 by Tim Graham <timograham@…>, 8 years ago

In 4095317:

[1.10.x] Fixed #26687 -- Made an i18n test not use a hardcoded path separator.

Fixed a failure on Windows.

Backport of e3877c53edb33271b0f31d20e60a924848692026 from master

comment:6 by Tim Graham <timograham@…>, 8 years ago

In 25e0273a:

[1.9.x] Fixed #26687 -- Made an i18n test not use a hardcoded path separator.

Fixed a failure on Windows.

Backport of e3877c53edb33271b0f31d20e60a924848692026 from master

comment:7 by Tim Graham <timograham@…>, 8 years ago

In c95487e2:

[1.8.x] Refs #26687 -- Made an i18n test not use a hardcoded path separator.

This reverts commit c0a1e1984e0028022c5ac0722ff4933317bcdbc2 as it doesn't
work on the stable/1.8.x branch and instead uses os.path.join() to fix the
original failure on Windows.

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