Skip to content

Commit 5ceed37

Browse files
committed
Clarifying why test_name_with_patch_context_manager_failure doesnt work
1 parent 4deacc5 commit 5ceed37

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test_method_call.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
@pytest.mark.xfail(strict=True)
66
def test_name_with_patch_context_manager_failure():
77
"""We are patching the method within the module.
8-
But this isn't exactly what's used by Person"""
8+
But this isn't exactly what's used by Person.
9+
Since person.py had `from data_source import get_name`
10+
if person.py had `import data_source` instead, this test would pass.
11+
"""
912
the_person = Person()
1013
with patch("data_source.get_name", return_value="Bob"):
1114
name = the_person.name()

0 commit comments

Comments
 (0)