Commit Graph

39139 Commits

Author SHA1 Message Date
Victor Stinner e40390473d support.temp_dir(): call support.rmtree() instead of shutil.rmtree() 2016-03-24 17:42:10 +01:00
Victor Stinner 3899b549e3 test_os: use support.rmtree() to cleanup WalkTests 2016-03-24 17:21:17 +01:00
Victor Stinner ae39d236b4 Enhance and modernize test_os
* add create_file() helper function
* create files using "x" mode instead of "w" to detect when a previous test
  forget to remove a file
* open file for writing in unbuferred mode (buffering=0)
* replace "try/finally: unlink" with self.addCleanup(support.unlink)
* register unlink cleanup function *before* creating new files
2016-03-24 17:12:55 +01:00
Victor Stinner f95a19b900 test_os: use @support.requires_linux_version 2016-03-24 16:50:41 +01:00
Victor Stinner bc6b72ed06 Closes #26620: Fix ResourceWarning in test_urllib2_localnet
* Use context manager on urllib objects to ensure that they are closed on error
* Use self.addCleanup() to cleanup resources even if a test is interrupted
  with CTRL+c
2016-03-24 13:55:58 +01:00
Victor Stinner e321274b2e Enhance and modernize test_genericpath
* Replace "try/finally: os.remove()" with self.addCleanup(support.unlink) or
  self.addCleanup(support.rmdir): the support function handles the case when
  the file doesn't exist
* Replace "try/finally: f.close()" with "with open(...) as f:"
* test_getsize: add a second test with a different size
* Create file using "x" mode to ensure that the file didn't exist before, to
  detect bugs in tests
* Open files in unbuffered mode (buferring=0) to write immediatly data on disk
* Replace map() with simpler code
* Split isdir() unit test into two units tests to make them less dependant,
  same change for isfile() test
* test_samefile(): test also two different files
2016-03-24 13:44:19 +01:00
Victor Stinner ba8b0a7db4 Enhance os._DummyDirEntry
Issue #25911:

* Try to fix test_os.BytesWalkTests on Windows
* Try to mimick better the reference os.DirEntry on Windows
* _DummyDirEntry now caches os.stat() result
* _DummyDirEntry constructor now tries to get os.stat()
2016-03-24 12:23:18 +01:00
Victor Stinner 56db16cd44 regrtest: when parallel tests are interrupted, display progress 2016-03-24 12:04:15 +01:00
Victor Stinner 2b60b7237e regrtest: mention in tests run sequentially or in parallel 2016-03-24 11:55:29 +01:00
Victor Stinner 5de16e80c1 regrtest: fix --fromfile feature
* Update code for the name regrtest output format.
* Enhance also test_regrtest test on --fromfile
2016-03-24 09:43:00 +01:00
Victor Stinner 923590e397 Fix DeprecationWarning on Windows
Issue #25911: Use support.check_warnings() to expect or ignore
DeprecationWarning in test_os.
2016-03-24 09:11:48 +01:00
Victor Stinner 0069aef51a Fix test_spwd on OpenIndiana
Issue #18787: restore "bin" name in test_spwd but catch KeyError.
2016-03-23 21:15:55 +01:00
Victor Stinner c53195bbf0 Try to fix test_gdb on s390x SLES 3.x
Ignore empty lines in stderr.
2016-03-23 21:08:25 +01:00
Stefan Krah 66e9d03bf4 Issue #26621: Update libmpdec version and remove unnecessary test case. 2016-03-23 20:50:10 +01:00
Victor Stinner 4a1c7d2c36 Try to fix test_spwd on OpenIndiana
Issue #18787: try to get the "root" entry which should exist on all UNIX
instead of "bin" which doesn't exist on OpenIndiana.
2016-03-23 18:45:55 +01:00
Victor Stinner 904f5def5c Try to fix test_gdb on s390x buildbots 2016-03-23 18:32:54 +01:00
Victor Stinner 412a5e7e23 faulthandler: only log fatal exceptions
Issue #23848, #26622:

* faulthandler now only logs fatal Windows exceptions.
* write error code as decimal, not as hexadecimal
* replace "Windows exception" with "Windows fatal exception"
2016-03-23 14:44:14 +01:00
Victor Stinner 69649f21f0 regrtest: display test duration in sequential mode
Only display duration if a test takes more than 30 seconds.
2016-03-23 12:14:10 +01:00
Victor Stinner 404cdc5a92 faulthandler: add Windows exception handler
Issue #23848: On Windows, faulthandler.enable() now also installs an exception
handler to dump the traceback of all Python threads on any Windows exception,
not only on UNIX signals (SIGSEGV, SIGFPE, SIGABRT).
2016-03-23 10:39:17 +01:00
Victor Stinner 6d7f4f6675 regrtest: add timeout to main process when using -jN
libregrtest: add a watchdog to run_tests_multiprocess() using
faulthandler.dump_traceback_later().
2016-03-23 02:04:32 +01:00
Victor Stinner e19558af1b Add a source parameter to warnings.warn()
Issue #26604:

* Add a new optional source parameter to _warnings.warn() and warnings.warn()
* Modify asyncore, asyncio and _pyio modules to set the source parameter when
  logging a ResourceWarning warning
2016-03-23 00:28:08 +01:00
Victor Stinner f9a71153e9 Issue #26588: remove debug traces from _tracemalloc. 2016-03-22 23:54:42 +01:00
Victor Stinner 92c21d7a7c Issue #26588: skip test_warnings.test_tracemalloc() 2016-03-22 21:26:31 +01:00
Victor Stinner 84aab09421 Issue #26588: add debug traces
Try to debug random failure on buildbots.
2016-03-22 16:13:31 +01:00
Victor Stinner 24f949e10c regrtest: add time to output
Timestamps should help to debug slow buildbots, and timeout and hang on
buildbots.
2016-03-22 15:14:09 +01:00
Victor Stinner 10b73e1748 Add C functions _PyTraceMalloc_Track()
Issue #26530:

* Add C functions _PyTraceMalloc_Track() and _PyTraceMalloc_Untrack() to track
  memory blocks using the tracemalloc module.
* Add _PyTraceMalloc_GetTraceback() to get the traceback of an object.
2016-03-22 13:39:05 +01:00
Victor Stinner e492ae50e2 tracemalloc now supports domains
Issue #26588:

* The _tracemalloc now supports tracing memory allocations of multiple address
  spaces (domains).
* Add domain parameter to tracemalloc_add_trace() and
  tracemalloc_remove_trace().
* tracemalloc_add_trace() now starts by removing the previous trace, if any.
* _tracemalloc._get_traces() now returns a list of (domain, size,
  traceback_frames): the domain is new.
* Add tracemalloc.DomainFilter
* tracemalloc.Filter: add an optional domain parameter to the constructor and a
  domain attribute
* Sublte change: use Py_uintptr_t rather than void* in the traces key.
* Add tracemalloc_config.use_domain, currently hardcoded to 1
2016-03-22 12:58:23 +01:00
Victor Stinner e0b75b7e87 Fix test_ssl.test_refcycle()
Issue #26590: support.check_warnings() stores warnins, but ResourceWarning now
comes with a reference to the socket object which indirectly keeps the socket
alive.
2016-03-21 17:26:04 +01:00
Serhiy Storchaka a051bf3afb Issue #26581: Use the first coding cookie on a line, not the last one. 2016-03-20 23:47:48 +02:00
Serhiy Storchaka e431d3c9aa Issue #26581: Use the first coding cookie on a line, not the last one. 2016-03-20 23:36:29 +02:00
Serhiy Storchaka fc6990d382 Issues #25643, #26581: Added new tests for detecting Python source code encoding. 2016-03-20 23:12:00 +02:00
Serhiy Storchaka 97eee1cfda Added new tests for detecting Python source code encoding. 2016-03-20 22:29:40 +02:00
Berker Peksag bd5b1a613b Issue #12813: uuid.uuid4() no longer depends on ctypes
uuid.uuid4() always uses os.urandom() after 756d040aa8e8.
2016-03-20 17:30:25 +02:00
Berker Peksag e2021f2ecd Issue #12813: uuid.uuid4() no longer depends on ctypes
uuid.uuid4() always uses os.urandom() after 756d040aa8e8.
2016-03-20 17:29:56 +02:00
Berker Peksag c0e7a9c72b Issue #19164: Improve exception message of uuid.UUID()
Patch by jgauthier.
2016-03-20 16:49:29 +02:00
Berker Peksag d02eb8a713 Issue #19164: Improve exception message of uuid.UUID()
Patch by jgauthier.
2016-03-20 16:49:10 +02:00
Berker Peksag 02cce69217 Issue #19265: Improve test coverage of datetime.tzinfo
Without the patch, line 1010 of Lib/datetime.py wasn't covered
by the test suite.

Patch by Colin Williams.
2016-03-19 13:16:52 +02:00
Berker Peksag e3385b4e3d Issue #19265: Improve test coverage of datetime.tzinfo
Without the patch, line 1010 of Lib/datetime.py wasn't covered
by the test suite.

Patch by Colin Williams.
2016-03-19 13:16:32 +02:00
Berker Peksag 3c3d7f4b99 Issue #18787: spwd.getspnam() now raises a PermissionError if the user
doesn't have privileges.
2016-03-19 11:44:17 +02:00
Victor Stinner 74879e4179 Try again to fix test_warnings on Windows
Issue #26567: normalize newlines in test_tracemalloc.
2016-03-19 10:00:08 +01:00
Berker Peksag cf934a1c9b Issue #26560: Avoid potential ValueError in BaseHandler.start_response
Initial patch by Peter Inglesby.
2016-03-19 09:05:59 +02:00
Berker Peksag 1cd4ff6284 Issue #26560: Avoid potential ValueError in BaseHandler.start_response
Initial patch by Peter Inglesby.
2016-03-19 09:04:59 +02:00
Victor Stinner bfab932971 Try to fix test_warnings on Windows
Issue #26567.
2016-03-19 02:51:45 +01:00
Victor Stinner eedf13fe23 Fix test_logging
Issue #26568: Fix implementation of showwarning() and formatwarning() for
test_logging.
2016-03-19 02:11:56 +01:00
Victor Stinner 914cde89d4 On ResourceWarning, log traceback where the object was allocated
Issue #26567:

* Add a new function PyErr_ResourceWarning() function to pass the destroyed
  object
* Add a source attribute to warnings.WarningMessage
* Add warnings._showwarnmsg() which uses tracemalloc to get the traceback where
  source object was allocated.
2016-03-19 01:03:51 +01:00
Victor Stinner 1231a4615f Add _showwarnmsg() and _formatwarnmsg() to warnings
Issue #26568: add new  _showwarnmsg() and _formatwarnmsg() functions to the
warnings module.

The C function warn_explicit() now calls warnings._showwarnmsg() with a
warnings.WarningMessage as parameter, instead of calling warnings.showwarning()
with multiple parameters.

_showwarnmsg() calls warnings.showwarning() if warnings.showwarning() was
replaced. Same for _formatwarnmsg(): call warnings.formatwarning() if it was
replaced.
2016-03-19 00:47:17 +01:00
Steve Dower 3ca3342307 Issue #26313: ssl.py _load_windows_store_certs fails if windows cert store is empty. Patch by Baji. 2016-03-17 15:02:53 -07:00
Steve Dower 8dd7aebc23 Issue #26313: ssl.py _load_windows_store_certs fails if windows cert store is empty. Patch by Baji. 2016-03-17 15:02:39 -07:00
Ned Deily c9188000d7 Issue #26583: merge from 3.5 2016-03-17 17:56:42 -04:00
Ned Deily 1c80b152bd Issue #26583: Skip test_timestamp_overflow in test_import if bytecode
files cannot be written.
2016-03-17 17:53:52 -04:00