Issue 33988: [EASY] [3.7] test_platform fails when run with -Werror
Created on 2018-06-28 10:37 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.
Messages (6)
msg320657 - (view)
Author: STINNER Victor (vstinner) *
Date: 2018-06-28 10:37
Date: 2018-06-28 10:38
Date: 2018-06-28 11:30
Date: 2018-06-28 11:55
Date: 2018-07-05 16:59
Date: 2018-07-05 17:00
Date: 2018-06-28 10:37
vstinner@apu$ ./python -Werror -m test -v test_platform ====================================================================== ERROR: test_dist (test.test_platform.PlatformTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/vstinner/prog/python/3.7/Lib/test/test_platform.py", line 270, in test_dist res = platform.dist() File "/home/vstinner/prog/python/3.7/Lib/platform.py", line 379, in dist "in Python 3.5", DeprecationWarning, stacklevel=2) DeprecationWarning: dist() and linux_distribution() functions are deprecated in Python 3.5 ====================================================================== ERROR: test_linux_distribution_encoding (test.test_platform.PlatformTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/vstinner/prog/python/3.7/Lib/test/test_platform.py", line 346, in test_linux_distribution_encoding distname, version, distid = platform.linux_distribution() File "/home/vstinner/prog/python/3.7/Lib/platform.py", line 305, in linux_distribution "in Python 3.5", DeprecationWarning, stacklevel=2) DeprecationWarning: dist() and linux_distribution() functions are deprecated in Python 3.5 The code calling the deprecated function should be surrounded by something like that: with support.check_warnings(('cgi.parse_qs is deprecated', DeprecationWarning)):msg320658 - (view) Author: STINNER Victor (vstinner) *
Date: 2018-06-28 10:38
Python 3.8 (master branch), platform.linux_distribution() and its the tests have been removed: see bpo-28167.msg320659 - (view) Author: Karthikeyan Singaravelan (xtreak) *
Date: 2018-06-28 11:30
I was looking into this and it seems that using replacing PendingDeprecationWarning with DeprecationWarning fixes the issue. Should I be using check_warnings? Attaching a patch of this so that I can raise a PR for the same. I grepped for PendingDeprecationWarning and there is a similar crash with test_ssl ➜ cpython git:(1bf9cc5) ✗ ./python -Werror -m test -v test_ssl == CPython 3.7.0 (v3.7.0:1bf9cc5, Jun 28 2018, 11:20:40) [GCC 5.4.0 20160609] == Linux-4.4.0-127-generic-x86_64-with-debian-stretch-sid little-endian == cwd: /home/cpython/build/test_python_31365 == CPU count: 1 == encodings: locale=UTF-8, FS=utf-8 Run tests sequentially 0:00:00 load avg: 0.08 [1/1] test_ssl test test_ssl crashed -- Traceback (most recent call last): File "/home/cpython/Lib/test/libregrtest/runtest.py", line 176, in runtest_inner test_runner() File "/home/cpython/Lib/test/test_ssl.py", line 4151, in test_main plat = func() File "/home/cpython/Lib/platform.py", line 305, in linux_distribution "in Python 3.5", DeprecationWarning, stacklevel=2) DeprecationWarning: dist() and linux_distribution() functions are deprecated in Python 3.5 test_ssl failed == Tests result: FAILURE == 1 test failed: test_ssl Total duration: 194 ms Tests result: FAILURE Thanksmsg320661 - (view) Author: STINNER Victor (vstinner) *
Date: 2018-06-28 11:55
Would you mind to create a PR instead of a patch file?msg321118 - (view) Author: STINNER Victor (vstinner) *
Date: 2018-07-05 16:59
New changeset f5770f354cb982303237d581ad2b296486475965 by Victor Stinner (Xtreak) in branch '3.7': bpo-33988: Fix test_warnings using -W error (GH-7985) https://github.com/python/cpython/commit/f5770f354cb982303237d581ad2b296486475965msg321119 - (view) Author: STINNER Victor (vstinner) *
Date: 2018-07-05 17:00
Thank you Karthikeyan Singaravelan for your fix!
History
Date
User
Action
Args
2022-04-11 14:59:02adminsetgithub: 78169
2018-07-05 17:00:35vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg321119
pull_requests: + pull_request7596 2018-06-28 11:55:56vstinnersetmessages: + msg320661 2018-06-28 11:30:54xtreaksetfiles: + 33988.patch
resolution: fixed
messages: + msg321119
stage: patch review -> resolved
2018-07-05 16:59:50vstinnersetmessages: + msg321118 2018-06-28 11:59:31xtreaksetstage: patch reviewpull_requests: + pull_request7596 2018-06-28 11:55:56vstinnersetmessages: + msg320661 2018-06-28 11:30:54xtreaksetfiles: + 33988.patch
nosy:
+ xtreak
messages:
+ msg320659
keywords: + patch
2018-06-28 10:38:22vstinnersetmessages: + msg320658 2018-06-28 10:37:19vstinnercreate