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: Fix Python 3 warnings in Python 2 tests
Type: behavior Stage: resolved
Components: Tests Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: vstinner Nosy List: python-dev, serhiy.storchaka, terry.reedy, vstinner
Priority: normal Keywords: patch

Created on 2014-09-05 10:45 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
fix_py3k_warn.patch vstinner, 2014-09-05 10:45
Messages (7)
msg226418 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-09-05 10:45
Running Python 2 test suite with "python -3 -Wd" displays a lot of DeprecationWarning warnings. Just one example:

/home/haypo/prog/python/2.7/Lib/test/test_ssl.py:2368: DeprecationWarning: urllib.urlopen() has been removed in Python 3.0 in favor of urllib2.urlopen()

Attached patch fix most of them (maybe all).
msg226421 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-09-05 12:36
Why test_support.check_py3k_warnings is not used in test_calltips.py? Or may be change the test to "1+0", "1//0" or "1.0/0.0"?
msg226437 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-09-05 18:09
Please just change '1/0' to '1//0'.  Any expression that raises something other than NameError or AttributeError will do. .get_entity evals user code and Idle previously crashed when other exceptions were not caught. Thanks, Serhiy, for catching this.

The other warned code appears to be essential to the corresponding test. I presume Serhiy checked this also.
msg226438 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-09-05 18:18
The rest of the patch LGTM.
msg226443 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-09-05 19:09
New changeset 0675b3a55941 by Victor Stinner in branch '2.7':
Issue #22340: Fix Python 3 warnings in Python 2 tests
http://hg.python.org/cpython/rev/0675b3a55941
msg226445 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-09-05 19:11
Ok, I replaced 1/0 with 1//0 in IDLE tests.

I also changed the context manager in test_collections, the sets module is just deprecated, it's not a Python 3 specific warning.

Thanks for the review Serhiy.
msg226449 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-09-05 19:41
New changeset 407653078135 by Victor Stinner in branch '2.7':
Issue #22340: Fix test_collections if the sets module was already imported
http://hg.python.org/cpython/rev/407653078135
History
Date User Action Args
2022-04-11 14:58:07adminsetgithub: 66536
2014-09-06 10:35:30berker.peksagsetstage: patch review -> resolved
2014-09-05 19:41:37python-devsetmessages: + msg226449
2014-09-05 19:11:45vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg226445
2014-09-05 19:09:05python-devsetnosy: + python-dev
messages: + msg226443
2014-09-05 18:18:40serhiy.storchakasetmessages: + msg226438
2014-09-05 18:09:31terry.reedysetassignee: vstinner
type: behavior
messages: + msg226437
stage: patch review
2014-09-05 12:36:53serhiy.storchakasetnosy: + serhiy.storchaka, terry.reedy
messages: + msg226421
2014-09-05 10:45:10vstinnercreate