diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2009-04-11 13:31:31 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2009-04-11 13:31:31 (GMT) |
commit | cd2e7042ae7d2ebd27c26c36aef9b761b1f9d22f (patch) | |
tree | 43881c01cee15dd9699c1153de28fda0d3d275b3 /Doc/library/test.rst | |
parent | b524825788847ac28d0bb56ea3c33d52bfe6798d (diff) | |
download | cpython-cd2e7042ae7d2ebd27c26c36aef9b761b1f9d22f.zip cpython-cd2e7042ae7d2ebd27c26c36aef9b761b1f9d22f.tar.gz cpython-cd2e7042ae7d2ebd27c26c36aef9b761b1f9d22f.tar.bz2 |
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 0a2814b..ccca299 100644 --- a/Doc/library/test.rst +++ b/Doc/library/test.rst @@ -339,6 +339,30 @@ The :mod:`test.test_support` module defines the following functions: .. versionadded:: 2.6 +.. 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:: 2.7 + + +.. 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:: 2.7 + + The :mod:`test.test_support` module defines the following classes: .. class:: TransientResource(exc[, **kwargs]) |