summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllibnet.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] gh-108834: Sync libregrtest with the main branch (#108966)Victor Stinner2023-09-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * gh-108834: regrtest reruns failed tests in subprocesses (#108839) When using --rerun option, regrtest now re-runs failed tests in verbose mode in fresh worker processes to have more deterministic behavior. So it can write its final report even if a test killed a worker progress. Add --fail-rerun option to regrtest: exit with non-zero exit code if a test failed pass passed when re-run in verbose mode (in a fresh process). That's now more useful since tests can pass when re-run in a fresh worker progress, whereas they failed when run after other tests when tests are run sequentially. Rename --verbose2 option (-w) to --rerun. Keep --verbose2 as a deprecated alias. Changes: * Fix and enhance statistics in regrtest summary. Add "(filtered)" when --match and/or --ignore options are used. * Add RunTests class. * Add TestResult.get_rerun_match_tests() method * Rewrite code to serialize/deserialize worker arguments as JSON using a new WorkerJob class. * Fix stats when a test is run with --forever --rerun. * If failed test names cannot be parsed, log a warning and don't filter tests. * test_regrtest.test_rerun_success() now uses a marker file, since the test is re-run in a separated process. * Add tests on normalize_test_name() function. * Add test_success() and test_skip() tests to test_regrtest. (cherry picked from commit 31c2945f143c6b80c837fcf09a5cfb85fea9ea4c) * gh-108834: regrtest --fail-rerun exits with code 5 (#108896) When the --fail-rerun option is used and a test fails and then pass, regrtest now uses exit code 5 ("rerun) instead of 2 ("bad test"). (cherry picked from commit 1170d5a292b46f754cd29c245a040f1602f70301) * gh-108416: Mark slow but not CPU bound test methods with requires_resource('walltime') (GH-108480) (cherry picked from commit 1e0d62793a84001e92f1c80b511d3a212b435acc) * Manually sync Lib/test/libregrtest/ from main --------- Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-40275: Use new test.support helper submodules in tests (GH-21743)Hai Shi2020-08-061-3/+4
|
* bpo-40275: Move transient_internet from test.support to socket_helper (GH-19711)Serhiy Storchaka2020-04-291-4/+5
|
* bpo-38614: Use test.support.INTERNET_TIMEOUT constant (GH-17565)Victor Stinner2019-12-101-3/+1
| | | | | Replace hardcoded timeout constants in tests with INTERNET_TIMEOUT of test.support, so it's easier to ajdust this timeout for all tests at once.
* bpo-37421: urllib.request tests call urlcleanup() (GH-14529)Victor Stinner2019-07-021-0/+11
| | | | | | | | urllib.request tests now call urlcleanup() to remove temporary files created by urlretrieve() tests and to clear the _opener global variable set by urlopen() and functions calling indirectly urlopen(). regrtest now checks if urllib.request._url_tempfiles and urllib.request._opener are changed by tests.
* bpo-36019: Use pythontest.net instead of example.com in network tests (GH-11941)Stéphane Wirtel2019-02-221-2/+4
|
* Remove unused variable in test_urllibnet. (#1598)Senthil Kumaran2017-05-161-1/+3
|
* Minor spell fix and formatting fixes in urllib tests. (#959)Senthil Kumaran2017-04-021-1/+1
|
* Fix self.fail() call in test_data_headerBerker Peksag2016-05-071-1/+1
|\
| * Fix self.fail() call in test_data_headerBerker Peksag2016-05-071-1/+1
| |
* | Replace example.com with pythontest.net in test_urllibnetBerker Peksag2016-05-071-12/+13
|\ \ | |/ | | | | example.com/404 returns 500 instead of 404 now.
| * Replace example.com with pythontest.net in test_urllibnetBerker Peksag2016-05-071-12/+13
| | | | | | | | example.com/404 returns 500 instead of 404 now.
* | Issue #23277: Remove unused sys and os importsBerker Peksag2016-04-241-1/+0
|/ | | | Patch by Jon Dufresne.
* Issue #21069: Move test_fileno() from test_urllibnet and rewrite itMartin Panter2016-04-091-11/+0
| | | | | | | | * No longer attempts to close already freed socket file descriptor * Use socket object to be compatible with Windows * Do not use a timeout to avoid complication with non-blocking mode * Use internal localhost server rather than depending on a third party * Avoid trouble with buffered HTTP data by testing tunnelled CONNECT data
* test_urllibnet: set timeout on test_fileno()Victor Stinner2016-03-301-1/+1
| | | | Use the default timeout of 30 seconds to avoid blocking forever.
* Issue #23788: Merge redundant test_bad_address() into test_urllibnetMartin Panter2015-12-161-6/+20
| | | | | | | In Python 2, these were duplicated; one for urllib.urlopen() and one for urllib2.urlopen(). The test_urllibnet version has a better precondition to avoid false failures with bad DNS, and the test_urllib2_localnet version had a more up-to-date comment and domain name.
* Suppress a couple more DeprecationWarnings in the test suite.R David Murray2014-06-111-1/+2
|
* Invoke test_urllibnet tests using unittest.main functionSenthil Kumaran2014-04-151-7/+3
|
* Issue #21069: Temporarily use www.google.com while investigatingNed Deily2014-03-271-1/+1
| | | | test_urllibnet.test_fileno intermittent failures with www.example.com.
* Issue #20939: Use www.example.com instead of www.python.org to avoid testNed Deily2014-03-271-13/+13
| | | | failures when ssl is not present.
* Issue #20939: merge from 3.3Ned Deily2014-03-151-1/+1
|
* merge 3.3 (#20695)Benjamin Peterson2014-02-201-4/+4
|
* Issue #19936: Added executable bits or shebang lines to Python scripts whichSerhiy Storchaka2014-01-161-2/+0
|\ | | | | | | | | | | | | requires them. Disable executable bits and shebang lines in test and benchmark files in order to prevent using a random system python, and in source files of modules which don't provide command line interface. Fixed shebang lines in the unittestgui and checkpip scripts.
| * Issue #19936: Added executable bits or shebang lines to Python scripts whichSerhiy Storchaka2014-01-161-2/+0
| | | | | | | | | | | | | | requires them. Disable executable bits and shebang lines in test and benchmark files in order to prevent using a random system python, and in source files of modules which don't provide command line interface. Fixed shebang line to use python3 executable in the unittestgui script.
* | Issue 19572: More silently skipped tests explicitly skipped.Zachary Ware2013-12-081-4/+3
|\ \ | |/
| * Issue 19572: More silently skipped tests explicitly skipped.Zachary Ware2013-12-081-4/+3
| |
* | Fix test_bad_address on Ubuntu 13.04Antoine Pitrou2013-05-251-1/+4
|\ \ | |/
| * Fix test_bad_address on Ubuntu 13.04Antoine Pitrou2013-05-251-1/+4
| |
* | Issue #3583: mention that testing whether a bad address not triggeringBrett Cannon2013-01-111-10/+9
| | | | | | | | an OSError can mean a bad DNS server and not an actual bug.
* | Replace IOError with OSError (#16715)Andrew Svetlov2012-12-251-1/+1
|/
* Fixes issue #16409: The reporthook callback made by the legacyGregory P. Smith2012-11-101-4/+30
| | | | | | urllib.request.urlretrieve API now properly supplies a constant non-zero block_size as it did in Python 3.2 and 2.7. This matches the behavior of urllib.request.URLopener.retrieve.
* Avoid failing in test_urllibnet.test_bad_address when some overzealousAntoine Pitrou2011-07-081-0/+8
| | | | | DNS service (e.g. OpenDNS) resolves a non-existent domain name. The test is now skipped instead.
* Issue #12138: fix use of transient_internet() in test_urllibnetAntoine Pitrou2011-05-221-77/+62
|
* Read HTTP response inside transient_internet()Antoine Pitrou2011-03-261-5/+10
|\
| * test_urllibnet: make it so that transient_internet() applies to theAntoine Pitrou2011-03-261-4/+8
|/ | | | whole HTTP exchange, not only the opening.
* TIMEOUT value change in URLTimeout Test. test.support.transient_internet has aSenthil Kumaran2010-12-151-1/+1
| | | | | | socket timeout of 30 when it checks for resource. Explicit overrding (like setting the 10) wont exhibit consistent behavior when tests are outside context manager. So, settting it 30.
* Fix Issue10119 - test_urllibnet failure when using support.transient_internet.Senthil Kumaran2010-10-171-20/+10
|
* Merged revisions 80675 via svnmerge fromSenthil Kumaran2010-05-011-0/+11
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r80675 | senthil.kumaran | 2010-05-01 13:31:56 +0530 (Sat, 01 May 2010) | 3 lines Fix issue8582: urllib.urlretrieve fails with ValueError: Invalid format string ........
* convert shebang lines: python -> python3Benjamin Peterson2010-03-111-1/+1
|
* Merged revisions 77727 via svnmerge fromEzio Melotti2010-01-241-9/+9
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r77727 | ezio.melotti | 2010-01-24 18:58:36 +0200 (Sun, 24 Jan 2010) | 1 line use assert[Not]IsInstance where appropriate ........
* convert old fail* assertions to assert*Benjamin Peterson2009-06-301-11/+11
|
* Merged revisions 67777,67779 via svnmerge fromAntoine Pitrou2008-12-151-1/+1
| | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r67777 | antoine.pitrou | 2008-12-14 23:33:55 +0100 (dim., 14 déc. 2008) | 3 lines try to fix failure in test_bad_address on some buildbots ........ r67779 | antoine.pitrou | 2008-12-15 01:39:51 +0100 (lun., 15 déc. 2008) | 1 line modify other occurrence of test_bad_address ........
* #2491: os.fdopen() is now almost an alias to the builtin open(), and accepts ↵Amaury Forgeot d'Arc2008-08-011-8/+4
| | | | | | the same parameters. It just checks that the first argument is a file descriptor.
* Make a new urllib package .Jeremy Hylton2008-06-181-9/+10
| | | | | | | | | | | | | It consists of code from urllib, urllib2, urlparse, and robotparser. The old modules have all been removed. The new package has five submodules: urllib.parse, urllib.request, urllib.response, urllib.error, and urllib.robotparser. The urllib.request.urlopen() function uses the url opener from urllib2. Note that the unittests have not been renamed for the beta, but they will be renamed in the future. Joint work with Senthil Kumaran.
* Patch for issue 2848, mostly by Humberto Diogenes, with a couple ofBarry Warsaw2008-06-121-6/+6
| | | | small fixes by Barry. This removes mimetools from the stdlib.
* #2621 rename test.test_support to test.supportBenjamin Peterson2008-05-201-5/+5
|
* Get the test to pass on space Ubuntu/Debian and ppc. It was failingNeal Norwitz2008-03-261-2/+5
| | | | to decode 'Journ\xc3\xa9es Python' as ASCII.
* Fixed test_urllibnetChristian Heimes2008-01-271-1/+3
|
* Merged revisions 60284-60349 via svnmerge fromChristian Heimes2008-01-271-10/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r60286 | christian.heimes | 2008-01-25 15:54:23 +0100 (Fri, 25 Jan 2008) | 1 line setup.py doesn't pick up changes to a header file ........ r60287 | christian.heimes | 2008-01-25 16:52:11 +0100 (Fri, 25 Jan 2008) | 2 lines Added the Python core headers Include/*.h and pyconfig.h as dependencies for the extensions in Modules/ It forces a rebuild of all extensions when a header files has been modified ........ r60291 | raymond.hettinger | 2008-01-25 20:24:46 +0100 (Fri, 25 Jan 2008) | 4 lines Changes 54857 and 54840 broke code and were reverted in Py2.5 just before it was released, but that reversion never made it to the Py2.6 head. ........ r60296 | guido.van.rossum | 2008-01-25 20:50:26 +0100 (Fri, 25 Jan 2008) | 2 lines Rewrite the list_inline_repeat overflow check slightly differently. ........ r60301 | thomas.wouters | 2008-01-25 22:09:34 +0100 (Fri, 25 Jan 2008) | 4 lines Use the right (portable) definition of the max of a Py_ssize_t. ........ r60303 | thomas.wouters | 2008-01-26 02:47:05 +0100 (Sat, 26 Jan 2008) | 5 lines Make 'testall' work again when building in a separate directory. test_distutils still fails when doing that. ........ r60305 | neal.norwitz | 2008-01-26 06:54:48 +0100 (Sat, 26 Jan 2008) | 3 lines Prevent this test from failing if there are transient network problems by retrying the host for up to 3 times. ........ r60306 | neal.norwitz | 2008-01-26 08:26:12 +0100 (Sat, 26 Jan 2008) | 12 lines Use a condition variable (threading.Event) rather than sleeps and checking a global to determine when the server is ready to be used. This slows the test down, but should make it correct. There was a race condition before where the server could have assigned a port, yet it wasn't ready to serve requests. If the client sent a request before the server was completely ready, it would get an exception. There was machinery to try to handle this condition. All of that should be unnecessary and removed if this change works. A NOTE was added as a comment about what needs to be fixed. The buildbots will tell us if there are more errors or if this test is now stable. ........ r60307 | neal.norwitz | 2008-01-26 08:38:03 +0100 (Sat, 26 Jan 2008) | 3 lines Fix exception in tearDown on ppc buildbot. If there's no directory, that shouldn't cause the test to fail. Just like it setUp. ........ r60308 | raymond.hettinger | 2008-01-26 09:19:06 +0100 (Sat, 26 Jan 2008) | 3 lines Make PySet_Add() work with frozensets. Works like PyTuple_SetItem() to build-up values in a brand new frozenset. ........ r60309 | neal.norwitz | 2008-01-26 09:26:00 +0100 (Sat, 26 Jan 2008) | 1 line The OS X buildbot had errors with the unavailable exceptions disabled. Restore it. ........ r60310 | raymond.hettinger | 2008-01-26 09:37:28 +0100 (Sat, 26 Jan 2008) | 4 lines Let marshal build-up sets and frozensets one element at a time. Saves the unnecessary creation of a tuple as intermediate container. ........ r60311 | raymond.hettinger | 2008-01-26 09:41:13 +0100 (Sat, 26 Jan 2008) | 1 line Update test code for change to PySet_Add(). ........ r60312 | raymond.hettinger | 2008-01-26 10:31:11 +0100 (Sat, 26 Jan 2008) | 1 line Revert PySet_Add() changes. ........ r60314 | georg.brandl | 2008-01-26 10:43:35 +0100 (Sat, 26 Jan 2008) | 2 lines #1934: fix os.path.isabs docs. ........ r60316 | georg.brandl | 2008-01-26 12:00:18 +0100 (Sat, 26 Jan 2008) | 2 lines Add missing things in re docstring. ........ r60317 | georg.brandl | 2008-01-26 12:02:22 +0100 (Sat, 26 Jan 2008) | 2 lines Slashes allowed on Windows. ........ r60319 | georg.brandl | 2008-01-26 14:41:21 +0100 (Sat, 26 Jan 2008) | 2 lines Fix markup again. ........ r60320 | andrew.kuchling | 2008-01-26 14:50:51 +0100 (Sat, 26 Jan 2008) | 1 line Add some items ........ r60321 | georg.brandl | 2008-01-26 15:02:38 +0100 (Sat, 26 Jan 2008) | 2 lines Clarify "b" mode under Unix. ........ r60322 | georg.brandl | 2008-01-26 15:03:47 +0100 (Sat, 26 Jan 2008) | 3 lines #1940: make it possible to use curses.filter() before curses.initscr() as the documentation says. ........ r60324 | georg.brandl | 2008-01-26 15:14:20 +0100 (Sat, 26 Jan 2008) | 3 lines #1473257: add generator.gi_code attribute that refers to the original code object backing the generator. Patch by Collin Winter. ........ r60325 | georg.brandl | 2008-01-26 15:19:22 +0100 (Sat, 26 Jan 2008) | 2 lines Move C API entries to the corresponding section. ........ r60326 | christian.heimes | 2008-01-26 17:43:35 +0100 (Sat, 26 Jan 2008) | 1 line Unit test fix from Giampaolo Rodola, #1938 ........ r60327 | gregory.p.smith | 2008-01-26 19:51:05 +0100 (Sat, 26 Jan 2008) | 2 lines Update docs for new callpack params added in r60188 ........ r60329 | neal.norwitz | 2008-01-26 21:24:36 +0100 (Sat, 26 Jan 2008) | 3 lines Cleanup the code a bit. test_rfind is failing on PPC and PPC64 buildbots, this might fix the problem. ........ r60330 | neal.norwitz | 2008-01-26 22:02:45 +0100 (Sat, 26 Jan 2008) | 1 line Always try to remove the test file even if close raises an exception ........ r60331 | neal.norwitz | 2008-01-26 22:21:59 +0100 (Sat, 26 Jan 2008) | 3 lines Reduce the race condition by signalling when the server is ready and not trying to connect before. ........ r60334 | neal.norwitz | 2008-01-27 00:13:46 +0100 (Sun, 27 Jan 2008) | 5 lines On some systems (e.g., Ubuntu on hppa) the flush() doesn't cause the exception, but the close() does. Will backport. ........ r60335 | neal.norwitz | 2008-01-27 00:14:17 +0100 (Sun, 27 Jan 2008) | 2 lines Consistently use tempfile.tempdir for the db_home directory. ........ r60338 | neal.norwitz | 2008-01-27 02:44:05 +0100 (Sun, 27 Jan 2008) | 4 lines Eliminate the sleeps that assume the server will start in .5 seconds. This should make the test less flaky. It also speeds up the test by about 75% on my box (20+ seconds -> ~4 seconds). ........ r60342 | neal.norwitz | 2008-01-27 06:02:34 +0100 (Sun, 27 Jan 2008) | 6 lines Try to prevent this test from being flaky. We might need a sleep in here which isn't as bad as it sounds. The close() *should* raise an exception, so if it didn't we should give more time to sync and really raise it. Will backport. ........ r60344 | jeffrey.yasskin | 2008-01-27 06:40:35 +0100 (Sun, 27 Jan 2008) | 3 lines Make rational.gcd() public and allow Rational to take decimal strings, per Raymond's advice. ........ r60345 | neal.norwitz | 2008-01-27 08:36:03 +0100 (Sun, 27 Jan 2008) | 3 lines Mostly reformat. Also set an error and return NULL if neither MS_WINDOWS nor UNIX is defined. This may have caused problems on cygwin. ........ r60346 | neal.norwitz | 2008-01-27 08:37:38 +0100 (Sun, 27 Jan 2008) | 3 lines Use int for the sign rather than a char. char can be signed or unsigned. It's system dependent. This might fix the problem with test_rfind failing. ........ r60347 | neal.norwitz | 2008-01-27 08:41:33 +0100 (Sun, 27 Jan 2008) | 1 line Add stdarg include for va_list to get this to compile on cygwin ........ r60348 | raymond.hettinger | 2008-01-27 11:13:57 +0100 (Sun, 27 Jan 2008) | 1 line Docstring nit ........ r60349 | raymond.hettinger | 2008-01-27 11:47:55 +0100 (Sun, 27 Jan 2008) | 1 line Removed an unnecessary and confusing paragraph from the namedtuple docs. ........
* Merged revisions 60124-60142 via svnmerge fromChristian Heimes2008-01-201-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r60131 | georg.brandl | 2008-01-20 12:13:29 +0100 (Sun, 20 Jan 2008) | 3 lines #1351692: in pprint, always call format() for dict and list items to enable custom formatting of contents via subclassing PrettyPrinter. ........ r60133 | georg.brandl | 2008-01-20 12:43:03 +0100 (Sun, 20 Jan 2008) | 2 lines #1178141: add addinfourl.code to get http status code from urllib. ........ r60134 | georg.brandl | 2008-01-20 13:05:43 +0100 (Sun, 20 Jan 2008) | 4 lines #856047: respect the ``no_proxy`` env var when checking for proxies in urllib and using the other ``_proxy`` env vars. Original patch by Donovan Baarda. ........ r60135 | georg.brandl | 2008-01-20 13:18:17 +0100 (Sun, 20 Jan 2008) | 4 lines #1664522: in urllib, don't read non-existing directories in ftp mode, returning a 0-byte file -- raise an IOError instead. Original patch from Phil Knirsch. ........ r60136 | georg.brandl | 2008-01-20 13:57:47 +0100 (Sun, 20 Jan 2008) | 2 lines #799369: document possible sys.platform values. ........ r60137 | georg.brandl | 2008-01-20 14:08:37 +0100 (Sun, 20 Jan 2008) | 2 lines #652749: document the constants added to the builtins by site.py. ........ r60138 | georg.brandl | 2008-01-20 14:59:46 +0100 (Sun, 20 Jan 2008) | 2 lines #1648: add sys.gettrace() and sys.getprofile(). ........ r60139 | georg.brandl | 2008-01-20 15:17:42 +0100 (Sun, 20 Jan 2008) | 2 lines #1669: don't allow shutil.rmtree() to be called on a symlink. ........ r60140 | georg.brandl | 2008-01-20 15:20:02 +0100 (Sun, 20 Jan 2008) | 2 lines Fix test_pyclbr after urllib change. ........ r60141 | christian.heimes | 2008-01-20 15:28:28 +0100 (Sun, 20 Jan 2008) | 1 line Fixed a wrong assumption in configure.in and Include/pyport.h. The is finite function is not called isfinite() but finite(). Sorry, my fault. :) ........ r60142 | georg.brandl | 2008-01-20 15:31:27 +0100 (Sun, 20 Jan 2008) | 2 lines #1876: fix typos in test_operator. ........