diff options
author | feuillemorte <fmorte@ya.ru> | 2018-04-10 20:18:05 +0300 |
---|---|---|
committer | feuillemorte <fmorte@ya.ru> | 2018-04-11 12:45:37 +0300 |
commit | 3d60f955f037e53a4be0a6561d664b8cb43367a9 (patch) | |
tree | e012f3cff8817eb328adaec8c3d5f378dc580ed2 /testing | |
parent | 659c044372ece204146fee9164fb6144c494eb58 (diff) | |
download | pytest-3d60f955f037e53a4be0a6561d664b8cb43367a9.tar.gz |
#3290 Added test
Diffstat (limited to 'testing')
-rw-r--r-- | testing/test_monkeypatch.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/testing/test_monkeypatch.py b/testing/test_monkeypatch.py index 4427908ab..b524df89b 100644 --- a/testing/test_monkeypatch.py +++ b/testing/test_monkeypatch.py @@ -327,3 +327,16 @@ def test_issue1338_name_resolving(): monkeypatch.delattr('requests.sessions.Session.request') finally: monkeypatch.undo() + + +def test_context(testdir): + testdir.makepyfile(""" + import functools + def test_partial(monkeypatch): + with monkeypatch.context() as m: + m.setattr(functools, "partial", 3) + assert functools.partial == 3 + """) + + result = testdir.runpytest() + result.stdout.fnmatch_lines("*1 passed*") |