classification
Title: test_urllib: unsetting missing 'env' variable
Type: Stage:
Components: Tests Versions: Python 3.1, Python 2.7, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: orsenthil Nosy List: barry, flox, georg.brandl, orsenthil, srid
Priority: normal Keywords:

Created on 2009-10-01 00:49 by srid, last changed 2010-04-12 06:45 by orsenthil. This issue is now closed.

Messages (14)
msg93384 - (view) Author: Sridhar Ratnakumar (srid) Date: 2009-10-01 00:49
test test_urllib failed -- Traceback (most recent call last):
  File "/home/apy/rrun/tmp/autotest/apy/lib/python2.6/test/
test_urllib.py", line 106, in setUp
    env.unset(k)
NameError: global name 'env' is not defined


Looking in trunk's copy I see this:

    def setUp(self):
        # Records changes to env vars
        self.env = test_support.EnvironmentVarGuard()
        # Delete all proxy related env vars
        for k, v in os.environ.iteritems():
            if 'proxy' in k.lower():
                del env[k]

Should not that be "del self.env[k]"?
msg93385 - (view) Author: Sridhar Ratnakumar (srid) Date: 2009-10-01 00:49
The above mentioned traceback occurs in 2.6.3rc1
msg93388 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2009-10-01 01:51
Fixed that in revision 75166. Even in release26-maint got to chnage it
from env.unset(k) to self.env.unset(k).
msg93394 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-10-01 07:56
Can this issue be closed then?
msg93395 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2009-10-01 08:58
This needs to be changed in python2.6 branch as well. I was hesitant as
barry was making the build. After the branch opens, I shall make the
changes in that and close the issue.
msg93573 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2009-10-05 04:17
Committed revision 75254 for release26-maint.
msg97421 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-01-08 17:48
The method does not work as expected.


See msg97419:
----------------------------------------------------------------------
Author: Sridhar Ratnakumar (srid)  	Date: 2010-01-08 18:26

I get this error while running Python 2.6.4 tests (on 64-bit Linux box)

test_urllib
test test_urllib failed -- Traceback (most recent call last):
  File "/home/apy/rrun/tmp/autotest/apy/lib/python2.6/test/test_urllib.py", line 104, in setUp
    for k, v in os.environ.iteritems():
RuntimeError: dictionary changed size during iteration
----------------------------------------------------------------------
msg97424 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-01-08 17:56
Index: Lib/test/test_urllib.py
===================================================================
--- Lib/test/test_urllib.py     (revision 77361)
+++ Lib/test/test_urllib.py     (working copy)
@@ -101,7 +101,7 @@
         # Records changes to env vars
         self.env = test_support.EnvironmentVarGuard()
         # Delete all proxy related env vars
-        for k, v in os.environ.iteritems():
+        for k in os.environ.keys():
             if 'proxy' in k.lower():
                 self.env.unset(k)
msg97426 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2010-01-08 18:26
Fixed in revision 77367
msg97429 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-01-08 18:40
Thanks. It should be propagated to 2.7.
msg97433 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2010-01-08 19:10
Yes, I indeed, I quickly moved to patch it up in the trunk and did a svn submit -m "..." I had your big patch for tests in the trunk. I have reverted it for now and shall fix this one only.
msg101535 - (view) Author: Sridhar Ratnakumar (srid) Date: 2010-03-22 21:14
Re-opening. test_urllib in 3.1.2 fail similarly (on Linux 64-bit):

test_urllib
Warning: os.environ was modified by test_urllib
test test_urllib failed -- Traceback (most recent call last):
  File "/home/apy/rrun/tmp/autotest/apy/lib/python3.1/test/test_urllib.py", line 122, in setUp
    for k in os.environ.keys():
  File "/home/apy/rrun/tmp/autotest/apy/lib/python3.1/_abcoll.py", line 404, in __iter__
    for key in self._mapping:
  File "/home/apy/rrun/tmp/autotest/apy/lib/python3.1/os.py", line 404, in __iter__
    for key in self.data:
RuntimeError: dictionary changed size during iteration
msg102428 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2010-04-06 00:44
Sridhar, I am unable to reproduce this bug in the 3.x (py3k and release31-maint) on 64 bit linux. I glance at the code to see any underpinnings for this RuntimeError and could not find any at the place the exception occurred.

Is it anyway related to other buildout issue you had mentioned? Can you provide the steps to reproduce?
msg102921 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2010-04-12 06:45
I am unable to reproduce this issue in the trunk/py3k. Buildbots have not complained either. I am closing this bug.
srid: If you have steps to reproduce, feel free to reopen it.
History
Date User Action Args
2010-04-12 06:45:20orsenthilsetstatus: open -> closed

messages: + msg102921
2010-04-06 00:44:57orsenthilsetmessages: + msg102428
2010-03-22 21:14:42sridsetstatus: closed -> open

messages: + msg101535
versions: + Python 3.1
2010-01-08 19:10:15orsenthilsetmessages: + msg97433
2010-01-08 18:40:20floxsetmessages: + msg97429
versions: + Python 2.7
2010-01-08 18:26:08orsenthilsetstatus: open -> closed
resolution: fixed
messages: + msg97426
2010-01-08 17:56:25floxsetmessages: + msg97424
2010-01-08 17:53:37floxsetmessages: - msg97423
2010-01-08 17:53:08floxsetmessages: + msg97423
2010-01-08 17:48:54floxsetstatus: closed -> open

nosy: + flox
messages: + msg97421

resolution: fixed -> (no value)
2009-10-05 04:17:12orsenthilsetstatus: open -> closed

messages: + msg93573
2009-10-01 08:58:06orsenthilsetnosy: + barry
messages: + msg93395
2009-10-01 07:56:21georg.brandlsetnosy: + georg.brandl
messages: + msg93394
2009-10-01 01:51:32orsenthilsetnosy: + orsenthil
messages: + msg93388

assignee: orsenthil
resolution: fixed
2009-10-01 00:50:00sridsetmessages: + msg93385
2009-10-01 00:49:09sridcreate