This commit is contained in:
feuillemorte
2018-04-10 20:18:05 +03:00
parent 659c044372
commit 3d60f955f0

View File

@@ -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*")