Skip to content

test: cover tmpdir get_user OSError fallback#14423

Open
cyphercodes wants to merge 1 commit intopytest-dev:mainfrom
cyphercodes:test/tmpdir-getuser-oserror
Open

test: cover tmpdir get_user OSError fallback#14423
cyphercodes wants to merge 1 commit intopytest-dev:mainfrom
cyphercodes:test/tmpdir-getuser-oserror

Conversation

@cyphercodes
Copy link
Copy Markdown

Summary

  • add regression coverage for tmpdir.get_user() when getpass.getuser() raises OSError
  • update the Windows env-var clearing test to remove all username variables checked by getpass

Refs #13835

Verification

  • python -m pytest testing/test_tmpdir.py::test_get_user_handles_oserror testing/test_tmpdir.py::test_get_user -q ✅ (1 passed, 1 skipped)
  • python -m pytest testing/test_tmpdir.py::test_tmp_path_fallback_tox_env testing/test_tmpdir.py::test_tmp_path_fallback_uid_not_found testing/test_tmpdir.py::test_get_user_uid_not_found testing/test_tmpdir.py::test_get_user_handles_oserror testing/test_tmpdir.py::test_get_user testing/test_tmpdir.py::test_tmp_path_factory_handles_invalid_dir_characters -q ✅ (5 passed, 1 skipped)
  • python -m pytest testing/test_tmpdir.py -q ✅ (40 passed, 1 skipped)

Duplicate PR check

@cyphercodes cyphercodes force-pushed the test/tmpdir-getuser-oserror branch from 32bd032 to 66209dc Compare April 27, 2026 03:51
@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Apr 27, 2026
@@ -0,0 +1 @@
The tmpdir user detection fallback is covered for Python 3.13+ environments where ``getpass.getuser()`` raises ``OSError``.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best use RST roles that would link to the respective docs.

Comment thread testing/test_tmpdir.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants