MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_get_user

Function test_get_user

testing/test_tmpdir.py:222–229  ·  view source on GitHub ↗

Test that get_user() function works even if environment variables required by getpass module are missing from the environment on Windows (#1010).

(monkeypatch)

Source from the content-addressed store, hash-verified

220
221@pytest.mark.skipif(not sys.platform.startswith("win"), reason="win only")
222def 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
232class TestNumberedDir:

Callers

nothing calls this directly

Calls 2

get_userFunction · 0.90
delenvMethod · 0.80

Tested by

no test coverage detected