summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_support.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2008-05-08 19:26:08 (GMT)
committerBrett Cannon <bcannon@gmail.com>2008-05-08 19:26:08 (GMT)
commit9d4418242757f616ca7041409c7015e166b2c9f9 (patch)
treeb9c710661263d4a496a94b101ecb0ecf6d5ed897 /Lib/test/test_support.py
parent80bb9d92e3fdf671cb4f8ffeaadcaa1dedbe7876 (diff)
downloadcpython-9d4418242757f616ca7041409c7015e166b2c9f9.zip
cpython-9d4418242757f616ca7041409c7015e166b2c9f9.tar.gz
cpython-9d4418242757f616ca7041409c7015e166b2c9f9.tar.bz2
The mutex module has been deprecated for removal in 3.0.
Diffstat (limited to 'Lib/test/test_support.py')
-rw-r--r--Lib/test/test_support.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index 04a0ab8..fe5cf0f 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -37,6 +37,19 @@ class ResourceDenied(TestSkipped):
and unexpected skips.
"""
+def import_module(name, deprecated=False):
+ """Import the module to be tested, raising TestSkipped if it is not
+ available."""
+ with catch_warning():
+ if deprecated:
+ warnings.filterwarnings("ignore", ".+ module", DeprecationWarning)
+ try:
+ module = __import__(name, level=0)
+ except ImportError:
+ raise TestSkipped("No module named " + name)
+ else:
+ return module
+
verbose = 1 # Flag set to 0 by regrtest.py
use_resources = None # Flag set to [] by regrtest.py
max_memuse = 0 # Disable bigmem tests (they will still be run with