[Patches] [ python-Patches-851736 ] urllib2 CacheFTPHandler doesn't work on multiple dirs

SourceForge.net noreply at sourceforge.net
Sun May 9 09:07:20 EDT 2004


Patches item #851736, was opened at 2003-11-30 21:51
Message generated for change (Comment added) made by jjlee
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=851736&group_id=5470

Category: Library (Lib)
Group: None
Status: Open
Resolution: None
Priority: 6
Submitted By: John J Lee (jjlee)
Assigned to: Mark Hammond (mhammond)
Summary: urllib2 CacheFTPHandler doesn't work on multiple dirs

Initial Comment:
This is a fix for bug 738973. 
 
Where are functional tests supposed to go?  Is the 
__name__ == "__main__" block the official place?  The 
urllib2 functional tests are quite out of date, thanks to 
shifting URLs, so I'd like to fix them, but need to know 
where to do it. 

----------------------------------------------------------------------

>Comment By: John J Lee (jjlee)
Date: 2004-05-09 14:07

Message:
Logged In: YES 
user_id=261020

OK.  dirs is a list, though, so it should be:

+        key = user, host, port, tuple(dirs)


----------------------------------------------------------------------

Comment By: Mark Hammond (mhammond)
Date: 2004-05-09 09:58

Message:
Logged In: YES 
user_id=14198

Actually, wouldn't it be better to store 'dirs' directly in
the dict?

ie, instead of:
+        key = user, host, port, '/'.join(dirs)

just do:
+        key = user, host, port, dirs

Then the only assumption we make is that it is hashable.


----------------------------------------------------------------------

Comment By: Thomas Heller (theller)
Date: 2004-05-05 19:09

Message:
Logged In: YES 
user_id=11105

The problem with test code in the __main__ block is that
py2exe, for example, concludes that the unittest module is
needed.

If that is done, imo it would be better to write the main
block in this way, so that at least this is compiled away
with -O or -OO:

if __name__ == '__main__':
    if __debug__:
        import unittest
        # test code...

----------------------------------------------------------------------

Comment By: John J Lee (jjlee)
Date: 2004-05-05 18:43

Message:
Logged In: YES 
user_id=261020

Thanks Mark 
 
FWIW, the idea of having the test in __main__ is that it's a 
functional test, not a unit test.  But when I raised this issue on 
python-dev (thread ends at message whose URL is below), I 
left more confused than when I arrived, so feel free to put them 
where you like ;-) 
 
http://mail.python.org/pipermail/python-dev/2003-December/040861.html 
 

----------------------------------------------------------------------

Comment By: Mark Hammond (mhammond)
Date: 2004-05-05 13:23

Message:
Logged In: YES 
user_id=14198

The password is being dropped from the cache - I can't see
how this could possibly hurt though.  This all looks
reasonable to me, and fails (then works) as described.  I
will check this in in a couple of days to make sure noone
objects.  I won't check the test code in though - ideally,
it should go in the main test directory, but only if the
'network' resource is enabled - but I don't see that as a
blocking issue.

----------------------------------------------------------------------

Comment By: John J Lee (jjlee)
Date: 2004-05-04 23:13

Message:
Logged In: YES 
user_id=261020

For now at least, should probably just stick the test in the
if __name__ == "__main__"  block of urllib2 without its
unittest wrapper.

----------------------------------------------------------------------

Comment By: John J Lee (jjlee)
Date: 2003-11-30 21:53

Message:
Logged In: YES 
user_id=261020

 

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=851736&group_id=5470



More information about the Patches mailing list