diff options
author | Walter Dörwald <walter@livinglogic.de> | 2009-05-01 19:58:58 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2009-05-01 19:58:58 (GMT) |
commit | 155374d95d8ecd235d3a3edd92dd6f6a23d59f11 (patch) | |
tree | 91deb4c1d292387d2b216d869e79311cad1dbc61 /Doc/library | |
parent | 33841c34896834daa8ee38d3ff54d7800b9723c2 (diff) | |
download | cpython-155374d95d8ecd235d3a3edd92dd6f6a23d59f11.zip cpython-155374d95d8ecd235d3a3edd92dd6f6a23d59f11.tar.gz cpython-155374d95d8ecd235d3a3edd92dd6f6a23d59f11.tar.bz2 |
Merged revisions 72167 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72167 | walter.doerwald | 2009-05-01 19:35:37 +0200 (Fr, 01 Mai 2009) | 5 lines
Make test.test_support.EnvironmentVarGuard behave like a dictionary.
All changes are mirrored to the underlying os.environ dict, but rolled back
on exit from the with block.
........
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/test.rst | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Doc/library/test.rst b/Doc/library/test.rst index d196678..2da63ac 100644 --- a/Doc/library/test.rst +++ b/Doc/library/test.rst @@ -384,8 +384,13 @@ The :mod:`test.support` module defines the following classes: .. class:: EnvironmentVarGuard() Class used to temporarily set or unset environment variables. Instances can be - used as a context manager. + used as a context manager and have a complete dictionary interface for + querying/modifying the underlying ``os.environ``. After exit from the context + manager all changes to environment variables done through this instance will + be rolled back. + .. versionchanged:: 2.7 + Added dictionary interface. .. method:: EnvironmentVarGuard.set(envvar, value) @@ -396,6 +401,7 @@ The :mod:`test.support` module defines the following classes: Temporarily unset the environment variable ``envvar``. + .. class:: WarningsRecorder() Class used to record warnings for unit tests. See documentation of |