--- contrib/python/prompt-toolkit/py2/tests/test_contrib.py	(index)
+++ contrib/python/prompt-toolkit/py2/tests/test_contrib.py	(working tree)
@@ -194,7 +194,8 @@ def test_pathcompleter_does_not_expanduser_by_default():
     assert [] == completions
 
 
-def test_pathcompleter_can_expanduser():
+def test_pathcompleter_can_expanduser(monkeypatch):
+    monkeypatch.setenv('HOME', '/tmp')
     completer = PathCompleter(expanduser=True)
     doc_text = '~'
     doc = Document(doc_text, len(doc_text))