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
........
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 @@
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])