summaryrefslogtreecommitdiffstats
path: root/Doc/library/test.rst
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2009-04-11 14:30:59 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2009-04-11 14:30:59 (GMT)
commitfce769e73d05ec2e879a389320412f14ddb733ea (patch)
treeac3215914c4b036ece271ba4ede0189f68427924 /Doc/library/test.rst
parent2d87e42921c3dbf0833ddc51d5690a4032c19b6d (diff)
downloadcpython-fce769e73d05ec2e879a389320412f14ddb733ea.zip
cpython-fce769e73d05ec2e879a389320412f14ddb733ea.tar.gz
cpython-fce769e73d05ec2e879a389320412f14ddb733ea.tar.bz2
Merged revisions 71465 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r71465 | nick.coghlan | 2009-04-11 23:31:31 +1000 (Sat, 11 Apr 2009) | 1 line Issue 5354: Provide a standardised testing mechanism for doing fresh imports of modules, including the ability to block extension modules in order to test the pure Python fallbacks ........
Diffstat (limited to 'Doc/library/test.rst')
-rw-r--r--Doc/library/test.rst24
1 files changed, 24 insertions, 0 deletions
diff --git a/Doc/library/test.rst b/Doc/library/test.rst
index bc3d714..6add77d 100644
--- a/Doc/library/test.rst
+++ b/Doc/library/test.rst
@@ -322,6 +322,30 @@ The :mod:`test.support` module defines the following functions:
assert s.getvalue() == "hello"
+.. function:: import_module(name, deprecated=False)
+
+ This function imports and returns the named module. Unlike a normal
+ import, this function raises :exc:`unittest.SkipTest` if the module
+ cannot be imported.
+
+ Module and package deprecation messages are suppressed during this import
+ if *deprecated* is :const:`True`.
+
+ .. versionadded:: 3.1
+
+
+.. function:: import_fresh_module(name, blocked_names=None, deprecated=False)
+
+ This function imports and returns a fresh copy of the named Python module. The
+ ``sys.modules`` cache is bypassed temporarily, and the ability to import the
+ modules named in *blocked_names* is suppressed for the duration of the import.
+
+ Module and package deprecation messages are suppressed during this import
+ if *deprecated* is :const:`True`.
+
+ .. versionadded:: 3.1
+
+
The :mod:`test.support` module defines the following classes:
.. class:: TransientResource(exc[, **kwargs])