Using registry hack for 'My Documents', os=='nt' HOMESHARE, HOMEDRIVE, HOMEPATH, USERPROFILE and others are missing.
()
| 161 | @skip_if_not_win32 |
| 162 | @with_environment |
| 163 | def test_get_home_dir_8(): |
| 164 | """Using registry hack for 'My Documents', os=='nt' |
| 165 | |
| 166 | HOMESHARE, HOMEDRIVE, HOMEPATH, USERPROFILE and others are missing. |
| 167 | """ |
| 168 | os.name = 'nt' |
| 169 | # Remove from stub environment all keys that may be set |
| 170 | for key in ['HOME', 'HOMESHARE', 'HOMEDRIVE', 'HOMEPATH', 'USERPROFILE']: |
| 171 | env.pop(key, None) |
| 172 | |
| 173 | class key: |
| 174 | def __enter__(self): |
| 175 | pass |
| 176 | def Close(self): |
| 177 | pass |
| 178 | def __exit__(*args, **kwargs): |
| 179 | pass |
| 180 | |
| 181 | with patch.object(wreg, 'OpenKey', return_value=key()), \ |
| 182 | patch.object(wreg, 'QueryValueEx', return_value=[abspath(HOME_TEST_DIR)]): |
| 183 | home_dir = path.get_home_dir() |
| 184 | nt.assert_equal(home_dir, abspath(HOME_TEST_DIR)) |
| 185 | |
| 186 | @with_environment |
| 187 | def test_get_xdg_dir_0(): |