[Python-Dev] Test failures when running as root

Terry Reedy tjreedy at udel.edu
Tue Jan 14 04:03:43 CET 2014


On 1/13/2014 7:48 PM, Chris Angelico wrote:
> And now for something completely different.
>
> My root buildbot is finally now able to telnet out and get "Connection
> refused" errors. (For the curious, the VirtualBox "NAT" mode doesn't
> work properly, but the new "NAT Network" mode does. Why? I have no
> idea. But if anyone else is having the same problem, upgrade to the
> latest VirtualBox and set up a NAT Network. All I care is, it now
> works.) The test suite is now failing at another point, and this
> applies to 2.7, 3.3, and 3.x.
>
> ======================================================================
> ERROR: test_initgroups (test.test_posix.PosixGroupsTester)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>    File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/test_posix.py",
> line 1143, in test_initgroups
>      g = max(self.saved_groups) + 1
> ValueError: max() arg is an empty sequence

try:
   g = max(self.saved_groups) + 1
except ValueError:
   g = 1

> The saved_groups value comes from posix.getgroups(), and it's being
> used to try to get a group that this user doesn't have (I think). When
> I run Python as root, posix.getgroups() returns [0], but apparently
> it's not returning any groups when the test runs.

Unless someone says that it is a bug for posix.getgroups to return an 
empty list, I would say that the test should be fixed by trying the code 
above.

> So, two questions. Firstly, is this a problem that needs to be fixed
> in Python, or is it a configuration change that I made? It began
> failing recently, so possibly when I rebooted the VM as part of
> VirtualBox changes I mucked something up.
>
> And secondly, how can I run the tests manually?

If you build and keep a binary, it is easy. For example:

path-to-binary -m test text_posix

See doc chapter for test package and for 2.7 difference.

 > I can't find a binary inside the buildarea tree.
 > Does it get deleted afterward?

No experience with bbots.

> Apologies if these are dumb questions, hopefully they're a small
> distraction from PEP 460 arguments!

And welcomed.

-- 
Terry Jan Reedy



More information about the Python-Dev mailing list