MCPcopy
hub / github.com/pytest-dev/pytest / test_get_user

Function test_get_user

testing/test_tmpdir.py:426–433  ·  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

424
425@pytest.mark.skipif(not sys.platform.startswith("win"), reason="win only")
426def test_get_user(monkeypatch):
427 """Test that get_user() function works even if environment variables
428 required by getpass module are missing from the environment on Windows
429 (#1010).
430 """
431 monkeypatch.delenv("USER", raising=False)
432 monkeypatch.delenv("USERNAME", raising=False)
433 assert get_user() is None
434
435
436class TestNumberedDir:

Callers

nothing calls this directly

Calls 2

get_userFunction · 0.90
delenvMethod · 0.80

Tested by

no test coverage detected