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

Function get_user

src/_pytest/tmpdir.py:232–241  ·  view source on GitHub ↗

Return the current user name, or None if getuser() does not work in the current environment (see #1010).

()

Source from the content-addressed store, hash-verified

230
231
232def get_user() -> str | None:
233 """Return the current user name, or None if getuser() does not work
234 in the current environment (see #1010)."""
235 try:
236 # In some exotic environments, getpass may not be importable.
237 import getpass
238
239 return getpass.getuser()
240 except (ImportError, OSError, KeyError):
241 return None
242
243
244def pytest_configure(config: Config) -> None:

Callers 4

test_get_userFunction · 0.90
getbasetempMethod · 0.85

Calls

no outgoing calls

Tested by 3

test_get_userFunction · 0.72