This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_idle failure in leaks searching mode
Type: behavior Stage: resolved
Components: IDLE, Tests Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: kbk, martin.panter, python-dev, roger.serwy, serhiy.storchaka, terry.reedy
Priority: normal Keywords:

Created on 2015-11-27 18:13 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (8)
msg255472 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-11-27 18:13
$ ./python -m test.regrtest -uall -R 3:3 test_idle
[1/1] test_idle
beginning 6 repetitions
123456
test test_idle failed -- Traceback (most recent call last):
  File "/home/serhiy/py/cpython-debug/Lib/idlelib/idle_test/test_warning.py", line 76, in test_idlever
    self.assertEqual(len(w), 1)
AssertionError: 0 != 1

1 test failed:
    test_idle
msg255485 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-11-27 20:54
The test method was added in 3.5.

       with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter("always")
            import idlelib.idlever
            self.assertEqual(len(w), 1)
            self.assertTrue(issubclass(w[-1].category, DeprecationWarning))
            self.assertIn("version", str(w[-1].message))

It is copied replacements from https://docs.python.org/3.6/library/warnings.html#testing-warnings.

I see that test.support has a wrapper that might or might be easier or make a difference.

Replacing "import idlelib.idlever" with "test.support.import_fresh_module('idlelib.idlever')" might fix the problem.  I will test after I install the 10GB VS2015 package needed to build 3.5/6 on Windows.
msg265051 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-07 08:21
import_fresh_module() emits the deprecation warning twice.

>>> from test.support import import_fresh_module
>>> import_fresh_module('idlelib.idlever')
/home/serhiy/py/cpython-debug/Lib/test/support/__init__.py:166: DeprecationWarning: 
The separate Idle version was eliminated years ago;
idlelib.idlever is no longer used by Idle
and will be removed in 3.6 or later.  Use
    from sys import version
    IDLE_VERSION = version[:version.index(' ')]

  __import__(name)
/home/serhiy/py/cpython-debug/Lib/importlib/__init__.py:126: DeprecationWarning: 
The separate Idle version was eliminated years ago;
idlelib.idlever is no longer used by Idle
and will be removed in 3.6 or later.  Use
    from sys import version
    IDLE_VERSION = version[:version.index(' ')]

  return _bootstrap._gcd_import(name[level:], package, level)
<module 'idlelib.idlever' from '/home/serhiy/py/cpython-debug/Lib/idlelib/idlever.py'>
msg265637 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-05-15 18:01
From Mantin Panter's msg265606:

======================================================================
FAIL: test_idlever (idlelib.idle_test.test_warning.ImportWarnTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/db3l/buildarea/3.5.bolen-tiger/build/Lib/idlelib/idle_test/test_warning.py", line 76, in test_idlever
    self.assertEqual(len(w), 1)
AssertionError: 0 != 1

Serhiy got this by running leak tests, so that sys.modules caching prevented re-execution of warning code.  I am curious: are OSX builtbots doing something similar?  Or is the warning not being issued on the first import, making this a true failure?
msg265638 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-05-15 18:16
In msg255485 'copied replacements' should be 'copied with replacements'.  But 'import idlever' is not a reliable replacement for "# trigger a warning".

I wonder whether 'import_fresh_module' really executes the module twice, which seems foolish, or mere displays one warning twice.

It doesn't really matter here.  I have decided to remove the test.  We don't know if *anyone* imports idlever, and 3.6 will break nearly all external imports, not just that one, so this particular warning and test are not worth the time already spent on them.
msg265639 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-05-15 18:20
New changeset 5f561804bc8e by Terry Jan Reedy in branch '3.5':
Issue #25747: remove undependable and possibly useless test.
https://hg.python.org/cpython/rev/5f561804bc8e
msg265748 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-05-17 02:28
New changeset 9e1c859562bb by Terry Jan Reedy in branch '2.7':
Backports: #25747: remove bad test.  #27044: stop test_idle from leaking.
https://hg.python.org/cpython/rev/9e1c859562bb
msg267050 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-06-03 05:54
idlever.py is now gone in 3.6.
History
Date User Action Args
2022-04-11 14:58:24adminsetgithub: 69933
2016-06-03 05:54:53terry.reedysetmessages: + msg267050
2016-05-17 02:28:23python-devsetmessages: + msg265748
2016-05-15 18:21:47terry.reedysetstatus: open -> closed
assignee: terry.reedy
resolution: fixed
stage: resolved
2016-05-15 18:20:31python-devsetnosy: + python-dev
messages: + msg265639
2016-05-15 18:16:12terry.reedysetmessages: + msg265638
2016-05-15 18:01:56terry.reedysetnosy: + martin.panter
messages: + msg265637
2016-05-07 08:21:25serhiy.storchakasetmessages: + msg265051
2015-11-27 20:54:18terry.reedysetmessages: + msg255485
versions: + Python 3.5
2015-11-27 18:13:06serhiy.storchakacreate