summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_socket.py
Commit message (Collapse)AuthorAgeFilesLines
* Since it tests both ntohl and ntohs, the test should not be calledGuido van Rossum2002-09-161-1/+1
| | | | testNtoHL but testNtoH.
* Maybe this fixes test_socket on 64-bit Linux.Guido van Rossum2002-09-141-9/+13
|
* Skip UDP testing for MacPython (for now), it hangs. This may be due toJack Jansen2002-09-061-1/+3
| | | | GUSI/Threading interaction, I'm not sure, but I don't have the time to fix this right now.
* Don't use hex constants representing negative numbers.Guido van Rossum2002-08-121-1/+1
|
* testSendAll(): loop until all data is read; this was necessary atGuido van Rossum2002-08-081-3/+3
| | | | | | least on OS/2 (see note on SF patch 555085 by A I MacIntyre) but looks like the test *could* fail on any other platform too -- there's no guarantee that recv() reads all data.
* Whitespace normalization.Tim Peters2002-08-081-1/+1
|
* Replace docstrings on test functions witrh comments -- then unittestGuido van Rossum2002-08-081-31/+50
| | | | | | | | | | | | | prints function and module names, which is more informative now that we repeat some tests in slightly modified subclasses. Add a test for read() until EOF. Add test suites for line-buffered (bufsize==1) and a small custom buffer size (bufsize==2). Restructure testUnbufferedRead() somewhat to avoid a potentially infinite loop.
* Tighten the unbuffered readline test to distinguish between the two lines.Guido van Rossum2002-08-071-4/+4
|
* Oops. I accidentally commented out some tests.Guido van Rossum2002-08-071-4/+4
|
* "Unbuffered" mode of class _fileobject wasn't actually unbuffered,Guido van Rossum2002-08-071-6/+35
| | | | | | | | | | and this broke a Zope "pipelining" test which read multiple responses from the same connection (this attaches a new file object to the socket for each response). Added a test for this too. (I want to do some code cleanup too, but I thought I'd first fix the problem with as little code as possible, and add a unit test for this case. So that's what this checkin is about.)
* testGetServByName shouldn't check for getservbyname - the socket moduleSkip Montanaro2002-08-021-18/+17
| | | | should always have it.
* modify testGetServByName so it tries a few different protocols. In this daySkip Montanaro2002-08-021-5/+17
| | | | | | and age of rampant computer breakins I imagine there are plenty of systems with telnet disabled. Successful check of at least one getservbyname() call is required for success
* Enable test_socket again, if only to prevent mistakes like JeremyGuido van Rossum2002-07-311-2/+2
| | | | | thinking that he was running his new test by running "make test". Also, I can't get this to fail any more. Your turn. :-)
* Repair testNtoH for large long arguments.Jeremy Hylton2002-07-311-9/+8
| | | | | | If the long is large enough, the return value will be a negative int. In this case, calling the function a second time won't return the original value passed in.
* Extended socket.htonl and ntohl to accept longs.Jeremy Hylton2002-07-251-0/+11
| | | | | | | Fixes SF bug #568322. The code should raise an OverflowError if the long is > 32 bits, even on platforms where sizeof(long) > 4.
* Remove test that was none too picky about whether attributes exist.Jeremy Hylton2002-07-251-41/+0
|
* Get rid of relative imports in all unittests. Now anything thatBarry Warsaw2002-07-231-1/+1
| | | | | | | | | | | imports e.g. test_support must do so using an absolute package name such as "import test.test_support" or "from test import test_support". This also updates the README in Lib/test, and gets rid of the duplicate data dirctory in Lib/test/data (replaced by Lib/email/test/data). Now Tim and Jack can have at it. :)
* Remove a few lines that aren't used and cause problems on platformsGuido van Rossum2002-07-191-6/+0
| | | | | where recvfrom() on a TCP stream returns None for the address. This should address the remaining problems on FreeBSD.
* Add test for previous core dump when sending on closed socket withGuido van Rossum2002-07-191-1/+10
| | | | | | | | timeout. Added small sleeps to _testAccept() and _testRecv() in NonBlockingTCPTests, to reduce race conditions (I know, this is not the solution!)
* Add default timeout functionality. This adds setdefaulttimeout() andGuido van Rossum2002-07-181-0/+30
| | | | | getdefaulttimeout() functions to the socket and _socket modules, and appropriate tests.
* I get failures half of the time that I run this, so I'll disableGuido van Rossum2002-06-201-2/+2
| | | | | running this as part of the regular test suite again, until I have time to figure out why.
* Michael fixed the race conditions and removed the sleeps.Guido van Rossum2002-06-181-9/+55
| | | | | This is his SF patch 569697. I renamed main() to test_main() again so that this is run as part of the standard test suite.
* Temporarily disable the timeout and socket tests.Guido van Rossum2002-06-131-12/+12
| | | | | | They still run as standalone scripts, but when used as part of the regression test suite, they are effectively no-ops. (This is done by renaming test_main to main.)
* Comment out testHostnameRes() -- it depends on a correctly workingGuido van Rossum2002-06-131-10/+10
| | | | DNS, and we can't assume that.
* Fix non-blocking connect() for Windows. Refactored the codeGuido van Rossum2002-06-131-12/+2
| | | | | | | | | | | that retries the connect() call in timeout mode so it can be shared between connect() and connect_ex(), and needs only a single #ifdef. The test for this was doing funky stuff I don't approve of, so I removed it in favor of a simpler test. This allowed me to implement a simpler, "purer" form of the timeout retry code. Hopefully that's enough (if you want to be fancy, use non-blocking mode and decode the errors yourself, like before).
* Major overhaul of timeout sockets:Guido van Rossum2002-06-131-1/+4
| | | | | | | | | | | | | | | | | | | | - setblocking(0) and settimeout(0) are now equivalent, and ditto for setblocking(1) and settimeout(None). - Don't raise an exception from internal_select(); let the final call report the error (this means you will get an EAGAIN error instead of an ETIMEDOUT error -- I don't care). - Move the select to inside the Py_{BEGIN,END}_ALLOW_THREADS brackets, so other theads can run (this was a bug in the original code). - Redid the retry logic in connect() and connect_ex() to avoid masking errors. This probably doesn't work for Windows yet; I'll fix that next. It may also fail on other platforms, depending on what retrying a connect does; I need help with this. - Get rid of the retry logic in accept(). I don't think it was needed at all. But I may be wrong.
* Fix a typo.Guido van Rossum2002-06-131-1/+2
| | | | Add a sleep (yuck!) to _testRecvFrom() so the server can set up first.
* Remove some overly complicated ways to concatenate and repeat stringsGuido van Rossum2002-06-121-6/+7
| | | | using "".join(). Fold a long line.
* Don't test for Java, test for sys.getrefcount.Guido van Rossum2002-06-121-2/+2
|
* Some provisional changes to get more tests to run on Windows (I hope).Guido van Rossum2002-06-121-6/+8
|
* Argh. Typo. :-(Guido van Rossum2002-06-121-1/+1
|
* Allow absent fromfd(), for Windows.Guido van Rossum2002-06-121-0/+2
|
* testSetSockOpt() should not require the reuse flag to be 1 -- anyGuido van Rossum2002-06-121-2/+2
| | | | | nonzero value is OK. Also fixed the error message for this and for testGetSockOpt().
* Lose the message on assertEqual calls -- they actually hideGuido van Rossum2002-06-121-18/+15
| | | | information on what went wrong.
* New test suite for the socket module by Michael Gilfix.Guido van Rossum2002-06-121-165/+472
| | | | Changed test_timeout.py to conform to the guidelines in Lib/test/README.
* SF patch 555085 (timeout socket implementation) by Michael Gilfix.Guido van Rossum2002-06-061-10/+57
| | | | | | | | | | | | | I've made considerable changes to Michael's code, specifically to use the select() system call directly and to store the timeout as a C double instead of a Python object; internally, -1.0 (or anything negative) represents the None from the API. I'm not 100% sure that all corner cases are covered correctly, so please keep an eye on this. Next I'm going to try it Windows before Tim complains. No way is this a bugfix candidate. :-)
* Refcounting isn't available in Jython. Putting the jython test around it.Finn Bock2001-12-091-8/+9
| | | | This closes patch "[ #490414 ] Jython and test_socket".
* getnameinfo() appears to raise socket.error instead ofBarry Warsaw2001-11-091-1/+1
| | | | | socket.gaierror. :( This allows test_socket to pass on a RH6.1-ish Linux system.
* Correct getnameinfo refcounting and tuple parsing. Fixes #476648.Martin v. Löwis2001-11-021-0/+14
|
* Test sendall().Guido van Rossum2001-10-291-1/+1
|
* Make socket.getservbyname test optional on socket module having thatBarry Warsaw2001-03-231-5/+6
| | | | | | attribute. Jython does not have this function. Closes SF patch #403667.
* String method conversion.Eric S. Raymond2001-02-091-2/+1
|
* a bold attempt to fix things broken by MAL's verify patch: importFredrik Lundh2001-01-171-1/+1
| | | | 'verify' iff it's used by a test module...
* This patch removes all uses of "assert" in the regression test suiteMarc-André Lemburg2001-01-171-1/+1
| | | | | | | and replaces them with a new API verify(). As a result the regression suite will also perform its tests in optimization mode. Written by Marc-Andre Lemburg. Copyright assigned to Guido van Rossum.
* Update the code to better reflect recommended style:Fred Drake2000-12-121-1/+1
| | | | | Use != instead of <> since <> is documented as "obsolescent". Use "is" and "is not" when comparing with None or type objects.
* Skip Montanaro: modify test_socket.py to listen/connect using loopback addrGuido van Rossum2000-06-291-2/+2
|
* Fix the test so that connect() and bind() are called with a singleGuido van Rossum2000-03-241-2/+2
| | | | | | argument: a (host, port) tuple. Like multi-arg append(), multi-arg connect() and bind() may be ruled out!
* Mass check-in after untabifying all files that need it.Guido van Rossum1998-03-261-87/+87
|
* Fixed test for socket.error to work when it's a class exception.Guido van Rossum1997-10-011-1/+2
|
* socket_type --> SocketTypeFred Drake1997-06-031-1/+1
|