Issue 14698: test_posix failures - getpwduid()/initgroups()/getgroups() (original) (raw)

test_posix is consistently failing on the bigmem buildbot:

http://python.org/dev/buildbot/all/builders/AMD64 debian bigmem 3.x/builds/291/steps/test/logs/stdio

"""

ERROR: test_getgrouplist (test.test_posix.PosixTester)

Traceback (most recent call last): File "/var/tmpfs/martin.vonloewis/3.x.loewis-parallel2/build/Lib/test/test_posix.py", line 633, in test_getgrouplist set(posix.getgrouplist(pwd.getpwuid(os.getuid())[0], KeyError: 'getpwuid(): uid not found: 5025'

====================================================================== ERROR: test_initgroups (test.test_posix.PosixTester)

Traceback (most recent call last): File "/var/tmpfs/martin.vonloewis/3.x.loewis-parallel2/build/Lib/test/test_posix.py", line 111, in test_initgroups name = pwd.getpwuid(posix.getuid()).pw_name KeyError: 'getpwuid(): uid not found: 5025' """

I assume that's because the buildbot tests run with a UID without any corresponding pwd entry (which is legit). The attached patch should fix thoe failures, by making the tests more robust.