Issue 1124513: test_os fails on 2.4 (original) (raw)

Created on 2005-02-17 05:22 by brett.cannon, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg24316 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2005-02-17 05:22
Seems at test for os.environ that uses mapping_tests.py to make sure the object returned by os.environ has a mapping environment is failing under 2.4 (fine under 2.5) at least on OS X: test.test_support.TestFailed: Traceback (most recent call last): File "/Users/drifty/Code/cvs/Trees/python24/Lib/test/ mapping_tests.py", line 204, in test_update d.update(SimpleUserDict()) File "/Users/drifty/Code/cvs/Trees/python24/Lib/os.py", line 467, in update for k, v in items: File "/Users/drifty/Code/cvs/Trees/python24/Lib/test/ mapping_tests.py", line 202, in __getitem__ return self.d[i] KeyError: 0
msg24317 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2005-02-17 15:39
Logged In: YES user_id=31435 Confirming that test_os fails the same way on WinXP, on current release24-maint branch. But it does not fail under the released 2.4. Brett, can you clarify whether you're talking about 2.4 or about release24-maint here?
msg24318 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2005-02-17 21:24
Logged In: YES user_id=21627 This is now fixed in os.py 1.86 and 1.83.2.2, test_os.py 1.30.
msg24319 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2005-02-17 21:30
Logged In: YES user_id=89016 The new implementation of os._Environ.update() assumes that the argument dict is a mapping, if it provides a method items(), otherwise it treats it as an item sequence. Unfortunately the SimpleUserDict from mapping_tests.py provides only keys() and __getitem__(). So what is the minimal mapping interface? UserDict.DictMixin claims that keys and __getitem__ (and __setitem__ and __delitem__) is enough and adding __contains__, __iter__ and iteritems increases performance. So should update() try iteritems() or should an items() method be added to the SimpleUserDict in the test? CVS HEAD does not fail, because a test method test_update() has been added there, which hides the original method from mapping_tests.BasicTestMappingProtocol. Adding a call mapping_tests.BasicTestMappingProtocol.test_update(self) there results in the same exception as on the release24-maint branch.
msg24320 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2005-02-17 21:33
Logged In: YES user_id=89016 Oops, seems are comments have crossed, thanks for the fix.
History
Date User Action Args
2022-04-11 14:56:09 admin set github: 41589
2005-02-17 05:22:06 brett.cannon create