diff options
author | Walter Dörwald <walter@livinglogic.de> | 2009-05-01 17:35:37 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2009-05-01 17:35:37 (GMT) |
commit | 6733bed57e780008f8c78422d2a9676b9a2710cf (patch) | |
tree | 9ac7e1469b55cba61664a2b07e50566320a814d9 /Doc | |
parent | ca87fa5a5b650de2d4b5cb04fb5847cf631e75eb (diff) | |
download | cpython-6733bed57e780008f8c78422d2a9676b9a2710cf.zip cpython-6733bed57e780008f8c78422d2a9676b9a2710cf.tar.gz cpython-6733bed57e780008f8c78422d2a9676b9a2710cf.tar.bz2 |
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')
-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 ba2c3b8..b4a6c7a 100644 --- a/Doc/library/test.rst +++ b/Doc/library/test.rst @@ -401,9 +401,14 @@ The :mod:`test.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. .. versionadded:: 2.6 + .. versionchanged:: 2.7 + Added dictionary interface. .. method:: EnvironmentVarGuard.set(envvar, value) @@ -415,6 +420,7 @@ The :mod:`test.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 |