Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch OSError from getpass.getuser() #11875

Merged
merged 2 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -340,6 +340,7 @@ Ronny Pfannschmidt
Ross Lawley
Ruaridh Williamson
Russel Winder
Russell Martin
Ryan Puddephatt
Ryan Wooden
Sadra Barikbin
Expand Down
1 change: 1 addition & 0 deletions changelog/11875.bugfix.rst
@@ -0,0 +1 @@
Correctly handle errors from :func:`getpass.getuser` in Python 3.13.
2 changes: 1 addition & 1 deletion src/_pytest/tmpdir.py
Expand Up @@ -204,7 +204,7 @@
import getpass

return getpass.getuser()
except (ImportError, KeyError):
except (ImportError, OSError, KeyError):

Check warning on line 207 in src/_pytest/tmpdir.py

View check run for this annotation

Codecov / codecov/patch

src/_pytest/tmpdir.py#L207

Added line #L207 was not covered by tests
return None


Expand Down