Commit Graph

9 Commits

Author SHA1 Message Date
Benjamin Peterson 5c8da86f3a convert usage of fail* to assert* 2009-06-30 22:57:08 +00:00
Benjamin Peterson e14267bbad merge in the fix for test_ftplib on some bots [reviewed by Georg] 2008-09-28 20:57:21 +00:00
Benjamin Peterson 3c0c483af4 give ftplib a real test suite
A asyncore based mock ftp server is used to test the protocol.
This is all thanks to Giampaolo Rodola #3939

(Barry gave me permission to do this before final on IRC.)
2008-09-27 02:49:54 +00:00
Facundo Batista 4f1b1ed975 Fixed the semantic of timeout for socket.create_connection and
all the upper level libraries that use it, including urllib2.
Added and fixed some tests, and changed docs correspondingly.
Thanks to John J Lee for the patch and the pusing, :)
2008-05-29 16:39:26 +00:00
Trent Nelson e41b0061dd - Issue #2550: The approach used by client/server code for obtaining ports
to listen on in network-oriented tests has been refined in an effort to
  facilitate running multiple instances of the entire regression test suite
  in parallel without issue.  test_support.bind_port() has been fixed such
  that it will always return a unique port -- which wasn't always the case
  with the previous implementation, especially if socket options had been
  set that affected address reuse (i.e. SO_REUSEADDR, SO_REUSEPORT).  The
  new implementation of bind_port() will actually raise an exception if it
  is passed an AF_INET/SOCK_STREAM socket with either the SO_REUSEADDR or
  SO_REUSEPORT socket option set.  Furthermore, if available, bind_port()
  will set the SO_EXCLUSIVEADDRUSE option on the socket it's been passed.
  This currently only applies to Windows.  This option prevents any other
  sockets from binding to the host/port we've bound to, thus removing the
  possibility of the 'non-deterministic' behaviour, as Microsoft puts it,
  that occurs when a second SOCK_STREAM socket binds and accepts to a
  host/port that's already been bound by another socket.  The optional
  preferred port parameter to bind_port() has been removed.  Under no
  circumstances should tests be hard coding ports!

  test_support.find_unused_port() has also been introduced, which will pass
  a temporary socket object to bind_port() in order to obtain an unused port.
  The temporary socket object is then closed and deleted, and the port is
  returned.  This method should only be used for obtaining an unused port
  in order to pass to an external program (i.e. the -accept [port] argument
  to openssl's s_server mode) or as a parameter to a server-oriented class
  that doesn't give you direct access to the underlying socket used.

  Finally, test_support.HOST has been introduced, which should be used for
  the host argument of any relevant socket calls (i.e. bind and connect).

  The following tests were updated to following the new conventions:
    test_socket, test_smtplib, test_asyncore, test_ssl, test_httplib,
    test_poplib, test_ftplib, test_telnetlib, test_socketserver,
    test_asynchat and test_socket_ssl.

  It is now possible for multiple instances of the regression test suite to
  run in parallel without issue.
2008-04-08 23:47:30 +00:00
Neal Norwitz b0917c14f2 Don't use a hard coded port. This test could hang/fail if the port is in use.
Speed this test up by avoiding a sleep and using the event.
2008-02-26 04:50:37 +00:00
Neal Norwitz 0d4c06e06e Whitespace normalization. Ugh, we really need to do this more often.
You might want to review this change as it's my first time.  Be gentle. :-)
2007-04-25 06:30:05 +00:00
Facundo Batista 93c33680a0 Added the posibility to pass the timeout to FTP.connect, not only when
instantiating the class. Docs and tests are updated.
2007-03-30 13:00:35 +00:00
Facundo Batista 3f10099289 Forgot to add the file before the previous commit, here go
the ftplib tests.
2007-03-26 20:56:09 +00:00