New submission from Terry J. Reedy:

test.test_idle has long resulted in warnings about the locale being changed.  
In 3.6, this warning causes test_idle to be tagged a failure. Though this does 
not (yet) turn the overall run of a buildbot from green to red, it is annoying 
to have success reported as a failure.

The culprit is in iomenu: locale.setlocale(locale.LC_CTYPE, "") Commenting it 
out removed the warning and tests pass. But I don't know the real effect, if it 
would work for tests on all systems, and the consequence when running IDLE 
normally.

The problem cannot be monkey-patched away since the damage is done on import.  
Instead I added 'testing = False' to idlelib.__init__, made test_idle change it 
to True, and replace the locale-encoding code with "encoding = 'utf-8'" when 
testing is True.

Serhiy, I *think* this is ready.  However, another eagle-eye review would be 
welcome.  Tests also pass with 'ascii'.  Would that be better?

---
Side note: the locale and encoding code could use a review from someone who 
knows more that me.  For instance, suppressing ImportError here:

    try:
        import locale
        locale.setlocale(locale.LC_CTYPE, "")
    except (ImportError, locale.Error):
        pass

guarantees a NameError a few lines further.  There is another chunk labelled 
deprecated, and more might be obsolete in 3.x.  But this is another issue.

----------
assignee: terry.reedy
files: locale-change.diff
keywords: patch
messages: 269087
nosy: serhiy.storchaka, terry.reedy
priority: normal
severity: normal
stage: patch review
status: open
title: Test_idle should stop changing locale
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file43516/locale-change.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27372>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to