classification
Title: Fix test___all__ warning about modified environment
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ezio.melotti Nosy List: Arfrever, Michael.Cetrulo, brett.cannon, ezio.melotti, python-dev, serhiy.storchaka, zach.ware
Priority: normal Keywords: patch

Created on 2014-10-28 10:27 by Michael.Cetrulo, last changed 2014-11-02 18:41 by ezio.melotti. This issue is now closed.

Files
File name Uploaded Description Edit
locale_envchange_patch.diff Michael.Cetrulo, 2014-10-28 10:27 save and restore locale value review
Messages (5)
msg230136 - (view) Author: Michael Cetrulo (Michael.Cetrulo) * Date: 2014-10-28 10:27
The following warning is being generated when running test case:

  Warning -- locale was modified by test___all__

According to the comment there, importing the rlcompleter module changes (or used to change) the locale so after the import it was being set to 'C'

This patch reads the current locale before importing and resets it to that value afterwards.
msg230362 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2014-10-31 18:01
Are there cases where "import locale" might fail?
If so, it should maybe be moved in the try, otherwise the patch LGTM.
msg230378 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2014-10-31 18:59
It doesn't look like "import locale" can fail ("import _locale" can, but locale.py has emulation that would work with this patch).

LGTM.
msg230506 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-11-02 17:15
New changeset 37ed6eed0595 by Ezio Melotti in branch '3.4':
#22751: fix test___all__ warning about modified environment in the tests.  Patch by Michael Cetrulo.
https://hg.python.org/cpython/rev/37ed6eed0595

New changeset 16dfefe67c1f by Ezio Melotti in branch '2.7':
#22751: fix test___all__ warning about modified environment in the tests.  Patch by Michael Cetrulo.
https://hg.python.org/cpython/rev/16dfefe67c1f

New changeset 3c030e4da7c6 by Ezio Melotti in branch 'default':
#22751: merge with 3.4.
https://hg.python.org/cpython/rev/3c030e4da7c6
msg230515 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2014-11-02 18:41
The buildbot seems happy, so I'm going to close this.
Thanks for the patch!
History
Date User Action Args
2014-11-02 18:41:01ezio.melottisetstatus: open -> closed
resolution: fixed
messages: + msg230515

stage: commit review -> resolved
2014-11-02 17:15:42python-devsetnosy: + python-dev
messages: + msg230506
2014-10-31 18:59:39zach.waresetstage: patch review -> commit review
messages: + msg230378
versions: - Python 3.6
2014-10-31 18:23:50Arfreversetnosy: + Arfrever
2014-10-31 18:01:11ezio.melottisetnosy: + zach.ware, serhiy.storchaka
messages: + msg230362

assignee: ezio.melotti
stage: patch review
2014-10-28 13:40:32brett.cannonsetnosy: + brett.cannon
2014-10-28 10:27:38Michael.Cetrulocreate