#775964: skip YP/NIS entries instead of failing the test · pythoncapi/cpython@ec07331 · GitHub
Skip to content

Commit ec07331

Browse files
committed
#775964: skip YP/NIS entries instead of failing the test
Also includes doc updates mentioning that these entries may not be retrievable via getgrnam and getgrgid. Patch by Bobby Impollonia.
1 parent a80f4fb commit ec07331

5 files changed

Lines changed: 20 additions & 4 deletions

File tree

Doc/library/grp.rst

Lines changed: 3 additions & 1 deletion

Lib/test/test_grp.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,16 @@ def test_values(self):
3333
e2 = grp.getgrgid(e.gr_gid)
3434
self.check_value(e2)
3535
self.assertEqual(e2.gr_gid, e.gr_gid)
36-
e2 = grp.getgrnam(e.gr_name)
36+
name = e.gr_name
37+
if name.startswith('+') or name.startswith('-'):
38+
# NIS-related entry
39+
continue
40+
e2 = grp.getgrnam(name)
3741
self.check_value(e2)
3842
# There are instances where getgrall() returns group names in
3943
# lowercase while getgrgid() returns proper casing.
4044
# Discovered on Ubuntu 5.04 (custom).
41-
self.assertEqual(e2.gr_name.lower(), e.gr_name.lower())
45+
self.assertEqual(e2.gr_name.lower(), name.lower())
4246

4347
def test_errors(self):
4448
self.assertRaises(TypeError, grp.getgrgid)

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ Gerhard Häring
398398
Fredrik Håård
399399
Mihai Ibanescu
400400
Lars Immisch
401+
Bobby Impollonia
401402
Meador Inge
402403
Tony Ingraldi
403404
John Interrante

Misc/NEWS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ Library
3838
or otherwise not wait for exiting child processes.
3939

4040

41+
Tests
42+
-----
43+
44+
- Issue #775964: test_grp now skips YP/NIS entries instead of failing when
45+
encountering them.
46+
47+
4148
What's New in Python 3.2 Beta 1?
4249
================================
4350

Modules/grpmodule.c

Lines changed: 3 additions & 1 deletion

0 commit comments

Comments
 (0)