diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2009-04-11 14:30:59 +0000 |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2009-04-11 14:30:59 +0000 |
commit | ddcc51d0c42a4abc5f2a63a8dd74f69163c5ee66 (patch) | |
tree | 80d5c4d2d779b3835773c21267d04caa9274e1c9 /Doc/library/test.rst | |
parent | c8b8aab2a2e58a6c9c2f880e5cfe5ed49a73f085 (diff) | |
download | cpython-ddcc51d0c42a4abc5f2a63a8dd74f69163c5ee66.tar.gz |
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.rst | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Doc/library/test.rst b/Doc/library/test.rst index bc3d714e11..6add77d858 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]) |