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.

Unsupported provider

classification
Title: sporadic (?) test_urllib2 failures
Type: behavior Stage: resolved
Components: Library (Lib), Tests Versions: Python 3.3
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: orsenthil Nosy List: berker.peksag, orsenthil, pitrou, python-dev, r.david.murray
Priority: normal Keywords: patch

Created on 2012-03-17 00:26 by pitrou, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue14341.diff skrah, 2012-04-10 22:21
Messages (9)
msg156111 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-03-17 00:26
======================================================================
FAIL: test_method_deprecations (test.test_urllib2.OpenerDirectorTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.ochtman-gentoo-amd64/build/Lib/test/test_urllib2.py", line 628, in test_method_deprecations
    req.get_host()
  File "/home/buildbot/buildarea/3.x.ochtman-gentoo-amd64/build/Lib/contextlib.py", line 54, in __exit__
    next(self.gen)
  File "/home/buildbot/buildarea/3.x.ochtman-gentoo-amd64/build/Lib/test/support.py", line 776, in _filterwarnings
    missing[0])
AssertionError: filter ('', DeprecationWarning) did not catch any warning
msg157390 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2012-04-02 22:37
This occurs quite frequently now. In the latest build four bots
show this error.

http://www.python.org/dev/buildbot/all/builders/x86%20Ubuntu%20Shared%203.x/builds/5605/steps/test/logs/stdio
http://www.python.org/dev/buildbot/all/builders/AMD64%20FreeBSD%209.0%203.x/builds/2158/steps/test/logs/stdio
http://www.python.org/dev/buildbot/all/builders/x86%20XP-4%203.x/builds/6294/steps/test/logs/stdio
http://www.python.org/dev/buildbot/all/builders/AMD64%20Fedora%20without%20threads%203.x/builds/1911/steps/test/logs/stdio
msg157673 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-04-06 17:48
If one changes the stacklevel in the DeprecationWarnings in the library to '2' instead of '1' (I believe it should be '2'), then an interesting array of deprecation warnings are issued...including from cookiejar code.

Most of them are in the urllib2 tests, though, and obviously they aren't being correctly protected.

I'm not sure what is causing the deprecation test to sometimes succeed and sometimes fail, though.  Running python -m unittest.test_urllib2 consistently fails for me without the 1->2 change, and consistently passes (but with more warnings) with it.
msg157676 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2012-04-06 18:50
Running test_http_cookiejar and test_urllib2 in succession always
fails here. The same thing occurs when running test_urllib2
twice:

$ ./python -m test test_http_cookiejar test_urllib2
[1/2] test_http_cookiejar
[2/2] test_urllib2
test test_urllib2 failed -- Traceback (most recent call last):
  File "/home/stefan/pydev/cpython/Lib/test/test_urllib2.py", line 628, in test_method_deprecations
    req.get_host()
  File "/home/stefan/pydev/cpython/Lib/contextlib.py", line 54, in __exit__
    next(self.gen)
  File "/home/stefan/pydev/cpython/Lib/test/support.py", line 766, in _filterwarnings
    missing[0])
AssertionError: filter ('', DeprecationWarning) did not catch any warning

1 test OK.
1 test failed:
    test_urllib2
msg157993 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2012-04-10 22:21
How about silencing the AssertionError until a better solution
is found? The patch works here.
msg157994 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-04-10 22:47
Well, the point of the test is to check that the warnings are issued, so silencing them kind of defeats it.
Senthil, why did you use check_warning instead of assertWarns?
msg158042 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-04-11 15:06
New changeset 751c7b81f6ee by Senthil Kumaran in branch 'default':
use assertWarns instead of check_warnings - Issue14341
http://hg.python.org/cpython/rev/751c7b81f6ee
msg158043 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2012-04-11 15:11
Hi Antoine, 

I saw that check_warnings was commonly used ( and perhaps I had used to earlier without any problems) and overlooked assertWarns. But I think, it is good to remove support.check_warnings dependency here and just use assertWarnings.  Let me see if this squashes that sporadic failures in builldbots.

I think, the test_http_cookiejar and test_urllib2 dependency (if any) should also be looked at irrespective of this. I shall check that.

Thanks,
Senthil

Thanks.
msg228041 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2014-10-01 00:07
test_method_deprecations has been removed in https://hg.python.org/cpython/rev/b5980b1171d0. Closing this as out of date.
History
Date User Action Args
2022-04-11 14:57:28adminsetgithub: 58549
2014-10-01 00:07:01berker.peksagsetstatus: open -> closed

nosy: + berker.peksag
messages: + msg228041

resolution: out of date
stage: needs patch -> resolved
2014-05-13 21:49:30skrahsetnosy: - skrah
2012-04-11 15:11:00orsenthilsetmessages: + msg158043
2012-04-11 15:06:09python-devsetnosy: + python-dev
messages: + msg158042
2012-04-10 22:47:39pitrousetmessages: + msg157994
2012-04-10 22:21:11skrahsetfiles: + issue14341.diff
keywords: + patch
messages: + msg157993
2012-04-06 18:50:25skrahsetmessages: + msg157676
2012-04-06 17:48:17r.david.murraysetnosy: + r.david.murray
messages: + msg157673
2012-04-02 22:37:33skrahsetnosy: + skrah
messages: + msg157390
2012-03-17 00:26:08pitroucreate