mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
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 ........
This commit is contained in:
parent
2d87e42921
commit
fce769e73d
4 changed files with 105 additions and 34 deletions
|
@ -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])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue