mirror of
https://github.com/python/cpython.git
synced 2025-07-16 15:55:18 +00:00
Fix for issue 9367: the test code for os.getgroups
assumes that the result of getgroups and the output of the id(1) command return groups in the same order. That assumption is both fragile and false.
This commit is contained in:
parent
9c71f90329
commit
cb615e6abe
1 changed files with 5 additions and 1 deletions
|
@ -357,7 +357,11 @@ class PosixTester(unittest.TestCase):
|
||||||
if not groups:
|
if not groups:
|
||||||
raise unittest.SkipTest("need working 'id -G'")
|
raise unittest.SkipTest("need working 'id -G'")
|
||||||
|
|
||||||
self.assertEqual([int(x) for x in groups.split()], posix.getgroups())
|
# The order of groups isn't important, hence the calls
|
||||||
|
# to sorted.
|
||||||
|
self.assertEqual(
|
||||||
|
list(sorted([int(x) for x in groups.split()])),
|
||||||
|
list(sorted(posix.getgroups())))
|
||||||
|
|
||||||
class PosixGroupsTester(unittest.TestCase):
|
class PosixGroupsTester(unittest.TestCase):
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue