MCPcopy Index your code
hub / github.com/ipython/ipython / test_get_home_dir_8

Function test_get_home_dir_8

tests/test_path.py:181–206  ·  view source on GitHub ↗

Using registry hack for 'My Documents', os=='nt' HOMESHARE, HOMEDRIVE, HOMEPATH, USERPROFILE and others are missing.

(monkeypatch)

Source from the content-addressed store, hash-verified

179@skip_if_not_win32
180@with_environment
181def test_get_home_dir_8(monkeypatch):
182 """Using registry hack for 'My Documents', os=='nt'
183
184 HOMESHARE, HOMEDRIVE, HOMEPATH, USERPROFILE and others are missing.
185 """
186 monkeypatch.setattr(os, "name", "nt")
187 # Remove from stub environment all keys that may be set
188 for key in ["HOME", "HOMESHARE", "HOMEDRIVE", "HOMEPATH", "USERPROFILE"]:
189 env.pop(key, None)
190
191 class key:
192 def __enter__(self):
193 pass
194
195 def Close(self):
196 pass
197
198 def __exit__(*args, **kwargs):
199 pass
200
201 with (
202 patch.object(wreg, "OpenKey", return_value=key()),
203 patch.object(wreg, "QueryValueEx", return_value=[abspath(HOME_TEST_DIR)]),
204 ):
205 home_dir = path.get_home_dir()
206 assert home_dir == abspath(HOME_TEST_DIR)
207
208
209@with_environment

Callers

nothing calls this directly

Calls 2

keyClass · 0.85
popMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…