[Python-checkins] cpython (merge 3.4 -> default): merge 3.4
senthil.kumaran
python-checkins at python.org
Tue Apr 15 22:37:23 CEST 2014
http://hg.python.org/cpython/rev/d9ce31599f76
changeset: 90334:d9ce31599f76
parent: 90331:ec3ea80758a4
parent: 90333:9fe4d9686162
user: Senthil Kumaran <senthil at uthcode.com>
date: Tue Apr 15 16:37:14 2014 -0400
summary:
merge 3.4
files:
Lib/test/test_urllib2_localnet.py | 24 +++++++++++++-----
1 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py
--- a/Lib/test/test_urllib2_localnet.py
+++ b/Lib/test/test_urllib2_localnet.py
@@ -5,8 +5,11 @@
import http.server
import unittest
import hashlib
+
from test import support
+
threading = support.import_module('threading')
+
try:
import ssl
except ImportError:
@@ -57,14 +60,11 @@
request_handler.protocol_version = "HTTP/1.0"
self.httpd = LoopbackHttpServer(("127.0.0.1", 0),
request_handler)
- #print "Serving HTTP on %s port %s" % (self.httpd.server_name,
- # self.httpd.server_port)
self.port = self.httpd.server_port
def stop(self):
"""Stops the webserver if it's currently running."""
- # Set the stop flag.
self._stop_server = True
self.join()
@@ -232,6 +232,7 @@
# Test cases
+ at unittest.skipUnless(threading, "Threading required for this test.")
class ProxyAuthTests(unittest.TestCase):
URL = "http://localhost"
@@ -343,6 +344,7 @@
return FakeHTTPRequestHandler
+ at unittest.skipUnless(threading, "Threading required for this test.")
class TestUrlopen(unittest.TestCase):
"""Tests urllib.request.urlopen using the network.
@@ -590,9 +592,17 @@
self.assertEqual(index + 1, len(lines))
- at support.reap_threads
-def test_main():
- support.run_unittest(ProxyAuthTests, TestUrlopen)
+threads_key = None
+
+def setUpModule():
+ # Store the threading_setup in a key and ensure that it is cleaned up
+ # in the tearDown
+ global threads_key
+ threads_key = support.threading_setup()
+
+def tearDownModule():
+ if threads_key:
+ support.threading_cleanup(threads_key)
if __name__ == "__main__":
- test_main()
+ unittest.main()
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list