Test that get_user() function works even if environment variables required by getpass module are missing from the environment on Windows (#1010).
(monkeypatch)
| 220 | |
| 221 | @pytest.mark.skipif(not sys.platform.startswith("win"), reason="win only") |
| 222 | def test_get_user(monkeypatch): |
| 223 | """Test that get_user() function works even if environment variables |
| 224 | required by getpass module are missing from the environment on Windows |
| 225 | (#1010). |
| 226 | """ |
| 227 | monkeypatch.delenv("USER", raising=False) |
| 228 | monkeypatch.delenv("USERNAME", raising=False) |
| 229 | assert get_user() is None |
| 230 | |
| 231 | |
| 232 | class TestNumberedDir: |