@pytest.mark.skipif((not sys.platform.startswith('win')), reason='win only')
def test_get_user(monkeypatch):
 from _pytest.tmpdir import get_user
 monkeypatch.delenv('USER', raising=False)
 monkeypatch.delenv('USERNAME', raising=False)
 assert (get_user() is None)

@ pytest . mark . skipif ( ( not sys . platform . startswith ( 'win' ) ) , reason = 'win only' ) def test_get_user ( monkeypatch ) : from _pytest . tmpdir import get_user monkeypatch . delenv ( 'USER' , raising = False ) monkeypatch . delenv ( 'USERNAME' , raising = False ) assert ( get_user ( ) is None )
test that get_user() function works even if environment variables required by getpass module are missing from the environment on windows .