[8.0.x] Catch `OSError` from `getpass.getuser()`

This commit is contained in:
Russell Martin 2024-01-28 21:07:18 -05:00 committed by pytest bot
parent 169d775eec
commit 7d171c85e4
3 changed files with 3 additions and 1 deletions

View File

@ -338,6 +338,7 @@ Ronny Pfannschmidt
Ross Lawley
Ruaridh Williamson
Russel Winder
Russell Martin
Ryan Puddephatt
Ryan Wooden
Sadra Barikbin

View File

@ -0,0 +1 @@
Correctly handle errors from :func:`getpass.getuser` in Python 3.13.

View File

@ -203,7 +203,7 @@ def get_user() -> Optional[str]:
import getpass
return getpass.getuser()
except (ImportError, KeyError):
except (ImportError, OSError, KeyError):
return None