This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_getgroups in test_posix fails
Type: behavior Stage: resolved
Components: Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ronaldoussoren Nosy List: DazWorrall, r.david.murray, ronaldoussoren
Priority: normal Keywords: patch

Created on 2010-07-24 09:52 by DazWorrall, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
py3k-issue9367.diff DazWorrall, 2010-07-24 10:23 patch to fix the test
Messages (4)
msg111434 - (view) Author: Darren Worrall (DazWorrall) Date: 2010-07-24 09:52
In my checkout of py3k (r83123), test_getgroups in test_posix fails - the right elements are returned but the ordering is different:

$ ./python -m test.regrtest test_posix
test_posix
test test_posix failed -- Traceback (most recent call last):
  File "/home/daz/src/py3k/Lib/test/test_posix.py", line 360, in test_getgroups
    self.assertEqual([int(x) for x in groups.split()], posix.getgroups())
AssertionError: Lists differ: [1000, 4, 6, 20, 24, 46, 105, ... != [4, 6, 20, 24, 46, 105, 119, 1...

First differing element 0:
1000
4

- [1000, 4, 6, 20, 24, 46, 105, 119, 122, 125, 126, 128]
+ [4, 6, 20, 24, 46, 105, 119, 122, 125, 126, 128, 1000]

1 test failed:
    test_posix

Platform is Ubuntu 10.04 x86_64, kernel is 2.6.32 - unfortunately my C sucks so I'm not sure what's going on.
msg111445 - (view) Author: Darren Worrall (DazWorrall) Date: 2010-07-24 10:23
After a quick chat with Ronald at the EP sprint he says the ordering didnt matter, so here's a quick patch to check only for deltas.
msg111481 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-07-24 14:23
Committed a fix in:

3.2: r83133
3.1: r83134
2.7: r83135
2.6: r83136

I ended up committing a slightly different patch than attached here, the test now calls sorted to sort both lists before comparing, which IMO makes it slightly clearer.
msg111482 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-07-24 14:30
Except for the 2.6 backport, you could also have used assertItemsEqual, which is a smart wrapper around the idiom you implemented.
History
Date User Action Args
2022-04-11 14:57:04adminsetgithub: 53613
2010-07-24 14:31:17r.david.murraysetstatus: open -> closed
resolution: accepted -> fixed
2010-07-24 14:30:55r.david.murraysetstatus: pending -> open
nosy: + r.david.murray
messages: + msg111482

2010-07-24 14:23:43ronaldoussorensetstatus: open -> pending
type: behavior
messages: + msg111481

resolution: accepted
stage: resolved
2010-07-24 13:58:01ronaldoussorensetassignee: ronaldoussoren

nosy: + ronaldoussoren
2010-07-24 10:23:51DazWorrallsetfiles: + py3k-issue9367.diff
keywords: + patch
messages: + msg111445
2010-07-24 09:52:02DazWorrallcreate