diff options
author | holger krekel <holger@merlinux.eu> | 2011-12-16 22:41:23 +0000 |
---|---|---|
committer | holger krekel <holger@merlinux.eu> | 2011-12-16 22:41:23 +0000 |
commit | 40187ec9bbdd8681d83f9def9a02a8a03c94aece (patch) | |
tree | 80ee0692fc9aa860c954510a55602f5319a040d8 /testing/test_monkeypatch.py | |
parent | f5f8695587685884a24b9768b48c2d6a15837a77 (diff) | |
download | pytest-40187ec9bbdd8681d83f9def9a02a8a03c94aece.tar.gz |
robustify monkeypatch
Diffstat (limited to 'testing/test_monkeypatch.py')
-rw-r--r-- | testing/test_monkeypatch.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/testing/test_monkeypatch.py b/testing/test_monkeypatch.py index 973811025..bc093ef5e 100644 --- a/testing/test_monkeypatch.py +++ b/testing/test_monkeypatch.py @@ -59,6 +59,20 @@ def test_setitem(): monkeypatch.undo() assert d['x'] == 5 +def test_setitem_deleted_meanwhile(): + d = {} + monkeypatch = MonkeyPatch() + monkeypatch.setitem(d, 'x', 2) + del d['x'] + monkeypatch.undo() + assert not d + +def test_setenv_deleted_meanwhile(): + monkeypatch = MonkeyPatch() + monkeypatch.setenv('XYZ123', 'hello') + monkeypatch.undo() + assert 'XYZ123' not in os.environ + def test_delitem(): d = {'x': 1} monkeypatch = MonkeyPatch() |