Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_idle failure in leaks searching mode #69933

Closed
serhiy-storchaka opened this issue Nov 27, 2015 · 8 comments
Closed

test_idle failure in leaks searching mode #69933

serhiy-storchaka opened this issue Nov 27, 2015 · 8 comments
Assignees
Labels
tests Tests in the Lib/test dir topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 25747
Nosy @terryjreedy, @kbkaiser, @serwy, @vadmium, @serhiy-storchaka

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/terryjreedy'
closed_at = <Date 2016-05-15.18:21:47.975>
created_at = <Date 2015-11-27.18:13:06.904>
labels = ['expert-IDLE', 'type-bug', 'tests']
title = 'test_idle failure in leaks searching mode'
updated_at = <Date 2016-06-03.05:54:53.724>
user = 'https://github.com/serhiy-storchaka'

bugs.python.org fields:

activity = <Date 2016-06-03.05:54:53.724>
actor = 'terry.reedy'
assignee = 'terry.reedy'
closed = True
closed_date = <Date 2016-05-15.18:21:47.975>
closer = 'terry.reedy'
components = ['IDLE', 'Tests']
creation = <Date 2015-11-27.18:13:06.904>
creator = 'serhiy.storchaka'
dependencies = []
files = []
hgrepos = []
issue_num = 25747
keywords = []
message_count = 8.0
messages = ['255472', '255485', '265051', '265637', '265638', '265639', '265748', '267050']
nosy_count = 6.0
nosy_names = ['terry.reedy', 'kbk', 'roger.serwy', 'python-dev', 'martin.panter', 'serhiy.storchaka']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue25747'
versions = ['Python 3.5', 'Python 3.6']

@serhiy-storchaka
Copy link
Member Author

$ ./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

@serhiy-storchaka serhiy-storchaka added topic-IDLE tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Nov 27, 2015
@terryjreedy
Copy link
Member

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.

@serhiy-storchaka
Copy link
Member Author

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'>

@terryjreedy
Copy link
Member

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?

@terryjreedy
Copy link
Member

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.

@python-dev
Copy link
Mannequin

python-dev mannequin commented May 15, 2016

New changeset 5f561804bc8e by Terry Jan Reedy in branch '3.5':
Issue bpo-25747: remove undependable and possibly useless test.
https://hg.python.org/cpython/rev/5f561804bc8e

@terryjreedy terryjreedy self-assigned this May 15, 2016
@python-dev
Copy link
Mannequin

python-dev mannequin commented May 17, 2016

New changeset 9e1c859562bb by Terry Jan Reedy in branch '2.7':
Backports: bpo-25747: remove bad test. bpo-27044: stop test_idle from leaking.
https://hg.python.org/cpython/rev/9e1c859562bb

@terryjreedy
Copy link
Member

idlever.py is now gone in 3.6.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir topic-IDLE type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants