python/trunk/Lib/test/test_urllib.py (for ftpwrapper)

# Sorry, I posted to inapropreate mailing list. (Python-3000)
http://mail.python.org/pipermail/python-checkins/2007-May/060507.html
Hello. I'm using Windows2000, I tried some investigation for test_ftpwrapper.
After I did this change, most errors were gone.
Index: Lib/urllib.py =================================================================== --- Lib/urllib.py (revision 55584) +++ Lib/urllib.py (working copy) @@ -833,7 +833,7 @@ self.busy = 0 self.ftp = ftplib.FTP() self.ftp.connect(self.host, self.port, self.timeout) - self.ftp.login(self.user, self.passwd) +# self.ftp.login(self.user, self.passwd) for dir in self.dirs: self.ftp.cwd(dir)
I don't know, but probably 'login' on Win2000 is problamatic.
Remaining error is:
File "e:\python-dev\trunk\lib\threading.py", line 460, in __bootstrap self.run() File "e:\python-dev\trunk\lib\threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "test_urllib.py", line 565, in server conn.recv(13) error: (10035, 'The socket operation could not complete without blocking')
And after commented out conn.recv block in test_urllib.py, test passed fine.
def server(evt): serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) serv.settimeout(3) serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) serv.bind(("", 9093)) serv.listen(5) try: conn, addr = serv.accept() conn.send("1 Hola mundo\n") """ cantdata = 0 while cantdata < 13: data = conn.recv(13-cantdata) cantdata += len(data) time.sleep(.3) """ conn.send("2 No more lines\n") conn.close() except socket.timeout: pass finally: serv.close() evt.set()

* ocean ocean@m2.ccsnet.ne.jp [2007-05-26 13:50:40]:
http://mail.python.org/pipermail/python-checkins/2007-May/060507.html
Hello. I'm using Windows2000, I tried some investigation for test_ftpwrapper.
After I did this change, most errors were gone.
Index: Lib/urllib.py
--- Lib/urllib.py (revision 55584) +++ Lib/urllib.py (working copy) @@ -833,7 +833,7 @@ self.busy = 0 self.ftp = ftplib.FTP() self.ftp.connect(self.host, self.port, self.timeout)
self.ftp.login(self.user, self.passwd)
+# self.ftp.login(self.user, self.passwd) for dir in self.dirs: self.ftp.cwd(dir)
The init function in urllib is called under cases when ftp retrive has failed with one of ftp related errors. ( non-programmatic) Under those cases, my assumption is we might require the ftp.login to be present. Are you sure, this change does not affect anyother places?

ocean wrote:
After I did this change, most errors were gone.
Index: Lib/urllib.py
--- Lib/urllib.py (revision 55584) +++ Lib/urllib.py (working copy) @@ -833,7 +833,7 @@ self.busy = 0 self.ftp = ftplib.FTP() self.ftp.connect(self.host, self.port, self.timeout)
self.ftp.login(self.user, self.passwd)
+# self.ftp.login(self.user, self.passwd) for dir in self.dirs: self.ftp.cwd(dir)
I don't know, but probably 'login' on Win2000 is problamatic.
But you can *not* do this, you're trimming functionality from this class.
The test that I left commented out in test_urllib.py just tries to simulate the first two FTP server answers, one saying "hello", and the other asking for the user.
This is just to test ftpwrapper in its more basic first steps. The simulation goes ok in linux, but not in windows. But the problem is clearly in the tests, even if I can not find it, not in the urllib module.
Regards,
participants (3)
-
Facundo Batista
-
O.R.Senthil Kumaran
-
ocean