[issue10585] 2.6 maintenance branch erroneously uses unittest.TestCase.assertListEqual (added in 2.7)

Dave Malcolm report at bugs.python.org
Tue Nov 30 00:27:21 CET 2010


New submission from Dave Malcolm <dmalcolm at redhat.com>:

2.6.6 has an erronenous use of a unittest method that was added in 2.7, but it's only seen when running as root.  More specificially, with this guard:
    if posix.getuid() == 0 and hasattr(posix, 'getgroups') and sys.platform != 'darwin':

[david at surprise 2.6-clean]$ sudo ./python -m test.test_posix
   (snip)
======================================================================
ERROR: test_setgroups (__main__.PosixGroupsTester)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python2.6/test/test_posix.py", line 356, in test_setgroups
    self.assertListEqual(groups, posix.getgroups())
AttributeError: 'PosixGroupsTester' object has no attribute 'assertListEqual'

----------------------------------------------------------------------
Ran 29 tests in 0.020s

FAILED (errors=1)

Seems to have come from r83126.  Fix would seem to be to replace the assertListEqual with AssertEqual.  Am attaching a patch.

----------
components: Tests
files: 2.6-fix-test_setgroups.patch
keywords: easy, patch
messages: 122872
nosy: dmalcolm
priority: normal
severity: normal
stage: patch review
status: open
title: 2.6 maintenance branch erroneously uses unittest.TestCase.assertListEqual (added in 2.7)
versions: Python 2.6
Added file: http://bugs.python.org/file19877/2.6-fix-test_setgroups.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10585>
_______________________________________


More information about the Python-bugs-list mailing list