summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2008-07-02 01:57:08 (GMT)
committerBrett Cannon <bcannon@gmail.com>2008-07-02 01:57:08 (GMT)
commit8bb8fa5dd679d1f4086fac4d3181f0985c14006d (patch)
treed42673a3deb34bb5c03202b979b766eb89bb20a2 /Lib/test
parentaac51b8a69d65533f511f0483c797fcf6a6c696c (diff)
downloadcpython-8bb8fa5dd679d1f4086fac4d3181f0985c14006d.zip
cpython-8bb8fa5dd679d1f4086fac4d3181f0985c14006d.tar.gz
cpython-8bb8fa5dd679d1f4086fac4d3181f0985c14006d.tar.bz2
Handle urllib's renaming for Python 3.0:
* Deprecate urllib.urlopen() in favor of urllib2.urlopen() for 3.0. * Update docs to mention split/rename of the module and deprecation of urlopen(). Changes to lib2to3 are in a separate commit. Work is for issue #2885.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_urllib.py24
-rw-r--r--Lib/test/test_urllibnet.py10
2 files changed, 21 insertions, 13 deletions
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
index 61e0202..1dcbbed 100644
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -640,16 +640,20 @@ class Pathname_Tests(unittest.TestCase):
def test_main():
- test_support.run_unittest(
- urlopen_FileTests,
- urlopen_HttpTests,
- urlretrieve_FileTests,
- QuotingTests,
- UnquotingTests,
- urlencode_Tests,
- Pathname_Tests,
- #FTPWrapperTests,
- )
+ import warnings
+ with test_support.catch_warning(record=False):
+ warnings.filterwarnings('ignore', ".*urllib\.urlopen.*Python 3.0",
+ DeprecationWarning)
+ test_support.run_unittest(
+ urlopen_FileTests,
+ urlopen_HttpTests,
+ urlretrieve_FileTests,
+ QuotingTests,
+ UnquotingTests,
+ urlencode_Tests,
+ Pathname_Tests,
+ #FTPWrapperTests,
+ )
diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py
index 5e225ee..0404b77 100644
--- a/Lib/test/test_urllibnet.py
+++ b/Lib/test/test_urllibnet.py
@@ -182,9 +182,13 @@ class urlretrieveNetworkTests(unittest.TestCase):
def test_main():
test_support.requires('network')
- test_support.run_unittest(URLTimeoutTest,
- urlopenNetworkTests,
- urlretrieveNetworkTests)
+ from warnings import filterwarnings
+ with test_support.catch_warning(record=False):
+ filterwarnings('ignore', '.*urllib\.urlopen.*Python 3.0',
+ DeprecationWarning)
+ test_support.run_unittest(URLTimeoutTest,
+ urlopenNetworkTests,
+ urlretrieveNetworkTests)
if __name__ == "__main__":
test_main()