summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorAntoine Pitrou <pitrou@free.fr>2017-09-18 21:50:44 (GMT)
committerGitHub <noreply@github.com>2017-09-18 21:50:44 (GMT)
commit88c60c9668f0aa732693517a60b851cc1dfce0cb (patch)
tree60a30eb883118025b6416f566e64598dac8b8a58 /Lib/test
parentb43c4caf81b10e5c7ebaeb3a712c6db584f60bbd (diff)
downloadcpython-88c60c9668f0aa732693517a60b851cc1dfce0cb.zip
cpython-88c60c9668f0aa732693517a60b851cc1dfce0cb.tar.gz
cpython-88c60c9668f0aa732693517a60b851cc1dfce0cb.tar.bz2
Trivial cleanups following bpo-31370 (#3649)
* Trivial cleanups following bpo-31370 * Also cleanup the "importlib._bootstrap_external" module
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/ssl_servers.py2
-rw-r--r--Lib/test/support/__init__.py1
-rw-r--r--Lib/test/test_httplib.py3
-rw-r--r--Lib/test/test_idle.py2
-rw-r--r--Lib/test/test_multiprocessing_main_handling.py3
-rw-r--r--Lib/test/test_thread.py2
-rw-r--r--Lib/test/test_threadsignals.py2
-rw-r--r--Lib/test/test_tools/test_sundry.py1
-rw-r--r--Lib/test/test_winreg.py2
-rw-r--r--Lib/test/test_wsgiref.py2
-rw-r--r--Lib/test/test_xmlrpc.py8
11 files changed, 9 insertions, 19 deletions
diff --git a/Lib/test/ssl_servers.py b/Lib/test/ssl_servers.py
index 8146467..bfe533c 100644
--- a/Lib/test/ssl_servers.py
+++ b/Lib/test/ssl_servers.py
@@ -2,13 +2,13 @@ import os
import sys
import ssl
import pprint
+import threading
import urllib.parse
# Rename HTTPServer to _HTTPServer so as to avoid confusion with HTTPSServer.
from http.server import (HTTPServer as _HTTPServer,
SimpleHTTPRequestHandler, BaseHTTPRequestHandler)
from test import support
-threading = support.import_module("threading")
here = os.path.dirname(__file__)
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index b2e4560..4f60507 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -2060,7 +2060,6 @@ def threading_cleanup(*original_values):
def reap_threads(func):
"""Use this function when threads are being used. This will
ensure that the threads are cleaned up even when the test fails.
- If threading is unavailable this function does nothing.
"""
@functools.wraps(func)
def decorator(*args):
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py
index ab798a2..bec994e 100644
--- a/Lib/test/test_httplib.py
+++ b/Lib/test/test_httplib.py
@@ -5,6 +5,7 @@ import itertools
import os
import array
import socket
+import threading
import unittest
TestCase = unittest.TestCase
@@ -1077,8 +1078,6 @@ class BasicTest(TestCase):
def test_response_fileno(self):
# Make sure fd returned by fileno is valid.
- threading = support.import_module("threading")
-
serv = socket.socket(
socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP)
self.addCleanup(serv.close)
diff --git a/Lib/test/test_idle.py b/Lib/test/test_idle.py
index b7ef70d..31fffd9 100644
--- a/Lib/test/test_idle.py
+++ b/Lib/test/test_idle.py
@@ -1,7 +1,7 @@
import unittest
from test.support import import_module
-# Skip test if _thread or _tkinter wasn't built, if idlelib is missing,
+# Skip test if _tkinter wasn't built, if idlelib is missing,
# or if tcl/tk is not the 8.5+ needed for ttk widgets.
tk = import_module('tkinter') # imports _tkinter
if tk.TkVersion < 8.5:
diff --git a/Lib/test/test_multiprocessing_main_handling.py b/Lib/test/test_multiprocessing_main_handling.py
index a9c5d69..fd93184 100644
--- a/Lib/test/test_multiprocessing_main_handling.py
+++ b/Lib/test/test_multiprocessing_main_handling.py
@@ -1,7 +1,6 @@
# tests __main__ module handling in multiprocessing
from test import support
-# Skip tests if _thread or _multiprocessing wasn't built.
-support.import_module('_thread')
+# Skip tests if _multiprocessing wasn't built.
support.import_module('_multiprocessing')
import importlib
diff --git a/Lib/test/test_thread.py b/Lib/test/test_thread.py
index 52f6c79..64ffe46 100644
--- a/Lib/test/test_thread.py
+++ b/Lib/test/test_thread.py
@@ -2,7 +2,7 @@ import os
import unittest
import random
from test import support
-thread = support.import_module('_thread')
+import _thread as thread
import time
import sys
import weakref
diff --git a/Lib/test/test_threadsignals.py b/Lib/test/test_threadsignals.py
index f93dd77..67a1c58 100644
--- a/Lib/test/test_threadsignals.py
+++ b/Lib/test/test_threadsignals.py
@@ -5,7 +5,7 @@ import signal
import os
import sys
from test import support
-thread = support.import_module('_thread')
+import _thread as thread
import time
if (sys.platform[:3] == 'win'):
diff --git a/Lib/test/test_tools/test_sundry.py b/Lib/test/test_tools/test_sundry.py
index 39e541b..2f9db94 100644
--- a/Lib/test/test_tools/test_sundry.py
+++ b/Lib/test/test_tools/test_sundry.py
@@ -40,7 +40,6 @@ class TestSundryScripts(unittest.TestCase):
for name in self.windows_only:
import_tool(name)
- @unittest.skipIf(not support.threading, "test requires _thread module")
def test_analyze_dxp_import(self):
if hasattr(sys, 'getdxp'):
import_tool('analyze_dxp')
diff --git a/Lib/test/test_winreg.py b/Lib/test/test_winreg.py
index 2be61ae..11d054e 100644
--- a/Lib/test/test_winreg.py
+++ b/Lib/test/test_winreg.py
@@ -4,7 +4,7 @@
import os, sys, errno
import unittest
from test import support
-threading = support.import_module("threading")
+import threading
from platform import machine
# Do this first so test will be skipped if module doesn't exist
diff --git a/Lib/test/test_wsgiref.py b/Lib/test/test_wsgiref.py
index 7708e20..8422b30 100644
--- a/Lib/test/test_wsgiref.py
+++ b/Lib/test/test_wsgiref.py
@@ -18,6 +18,7 @@ import os
import re
import signal
import sys
+import threading
import unittest
@@ -253,7 +254,6 @@ class IntegrationTests(TestCase):
# BaseHandler._write() and _flush() have to write all data, even if
# it takes multiple send() calls. Test this by interrupting a send()
# call with a Unix signal.
- threading = support.import_module("threading")
pthread_kill = support.get_attribute(signal, "pthread_kill")
def app(environ, start_response):
diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py
index c9099e0..15b7ae5 100644
--- a/Lib/test/test_xmlrpc.py
+++ b/Lib/test/test_xmlrpc.py
@@ -1175,13 +1175,7 @@ class GzipUtilTestCase(unittest.TestCase):
class ServerProxyTestCase(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
- if threading:
- self.url = URL
- else:
- # Without threading, http_server() and http_multi_server() will not
- # be executed and URL is still equal to None. 'http://' is a just
- # enough to choose the scheme (HTTP)
- self.url = 'http://'
+ self.url = URL
def test_close(self):
p = xmlrpclib.ServerProxy(self.url)