Commit Graph

412 Commits

Author SHA1 Message Date
Miss Islington (bot) 6396c77571
[3.13] gh-117657: Skip tests that fork with threads under TSan (GH-121599) (#121819)
This avoids messages like:

  ThreadSanitizer: starting new threads after multi-threaded fork is not
  supported. Dying (set die_after_fork=0 to override)
(cherry picked from commit 82a4dac9f6)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-15 21:10:37 +00:00
Miss Islington (bot) 9df7392eba
[3.13] gh-120868: Fix breaking change in `logging.config` when using `QueueHandler` (GH-120872) (GH-121078)
(cherry picked from commit 7d9c68513d)
2024-06-27 10:09:17 +01:00
Miss Islington (bot) 544a47212b
[3.13] gh-120683: Fix an error in logging.LogRecord timestamp (GH-120709) (GH-120933)
The integer part of the timestamp can be rounded up, while the millisecond
calculation truncates, causing the log timestamp to be wrong by up to 999 ms
(affected roughly 1 in 8 million timestamps).
(cherry picked from commit 1500a23f33)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-24 07:14:26 +00:00
Miss Islington (bot) 3c88898a69
[3.13] gh-119819: Conditional skip of logging tests that require multiprocessing subprocess support (GH-120476) (#120531)
gh-119819: Conditional skip of logging tests that require multiprocessing subprocess support (GH-120476)

Skip tests that require multiprocessing subprocess support.
(cherry picked from commit 92f6d400f7)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2024-06-15 08:32:22 +08:00
Miss Islington (bot) 71f86eedeb
[3.13] gh-119819: Update logging configuration to support joinable multiproc… (GH-120090) (GH-120093)
(cherry picked from commit 983efcf15b)
2024-06-05 07:59:41 +01:00
Miss Islington (bot) 7edc6bd627
[3.13] gh-119819: Update test to skip if _multiprocessing is unavailable. (GH-120067) (GH-120072)
(cherry picked from commit 109e1082ea)
2024-06-04 20:50:48 +01:00
Miss Islington (bot) 720a44d414
[3.13] gh-119819: Fix regression to allow logging configuration with multipr… (GH-120030) (GH-120035)
(cherry picked from commit 99d945c0c0)
2024-06-04 13:46:41 +01:00
Miss Islington (bot) feaecf8c33
[3.13] gh-118868: logging QueueHandler fix passing of kwargs (GH-118869) (GH-120032)
(cherry picked from commit dce14bb2dc)
2024-06-04 13:18:11 +01:00
Miss Islington (bot) 1dc7fcd803
[3.13] gh-119064: Use os_helper.FakePath instead of pathlib.Path in tests (GH-119065) (GH-119087)
(cherry picked from commit 0152dc4ff5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-16 10:51:18 +03:00
Serhiy Storchaka 02887c6428
gh-102402: Make test_relativeCreated_has_higher_precision less implementation dependent (GH-118062) 2024-04-30 17:35:19 +03:00
Victor Stinner 8f25cc9920
gh-102402: Fix logging test_relativeCreated_has_higher_precision() leak (#117985)
Fix a reference leak in test_relativeCreated_has_higher_precision()
of test_logging: don't reimport the logging the logging module.
2024-04-18 19:01:55 +02:00
Vinay Sajip 6d0bb43232
gh-117975: Ensure flush level is checked when configuring a logging MemoryHandler. (GH-117976) 2024-04-17 13:55:18 +01:00
Douglas Thor 1316692e8c
gh-102402: Fix floating point math issue by using `time.time_ns()` in `logging.LogRecord` (GH-102412) 2024-04-16 10:44:57 +01:00
Sam Gross 59864edd57
gh-117552: Add timeout in HTTPHandlerTest (#117553) 2024-04-08 10:46:56 -04:00
Serhiy Storchaka 269051d20e
gh-90535: Fix support of interval>1 in logging.TimedRotatingFileHandler (GH-116220)
Fix support of interval values > 1 in logging.TimedRotatingFileHandler
for when='MIDNIGHT' and when='Wx'.
2024-03-16 12:29:42 +02:00
Donghee Na 20578a1f68
gh-112536: Add TSAN builds on Github Actions (#116872) 2024-03-16 11:10:37 +01:00
Malcolm Smith 872c0714fc
gh-71052: Change Android's `sys.platform` from "linux" to "android"
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-03-11 19:25:39 +00:00
Serhiy Storchaka d8712fa0c7
gh-88352: Make TimedRotatingFileHandler tests more stable (GH-116409)
The tests failed (with less than 1% probability) if for example the file
was created at 11:46:03.999, but the record was emitted at 11:46:04.001,
with atTime=11:46:04, which caused an unexpected rollover. Ensure that the
tests are always run within the range of the same whole second.

Also share code between test_rollover_at_midnight and test_rollover_at_weekday.
2024-03-11 11:57:07 +02:00
Serhiy Storchaka 87faec28c7
gh-115809: Improve TimedRotatingFileHandler.getFilesToDelete() (GH-115812)
Improve algorithm for computing which rolled-over log files to delete
in logging.TimedRotatingFileHandler. It is now reliable for handlers
without namer and with arbitrary deterministic namer that leaves
the datetime part in the file name unmodified.
2024-03-03 09:42:08 +02:00
Serhiy Storchaka fee86fd9a4
gh-88352: Fix logging.TimedRotatingFileHandler (GH-116191)
* Do not overwrite already rolled over files. It happened at midnight or
  during the DST change and caused the loss of data.
* computeRollover() now always return the timestamp larger than the
  specified time.
* Fix computation of the rollover time during the DST change.
2024-03-01 17:50:08 +02:00
Gabriele Catania 113687a838
gh-93205: When rotating logs with no namer specified, match whole extension (GH-93224) 2024-02-21 23:09:06 +02:00
Serhiy Storchaka 91822018ee
gh-115233: Fix an example in the Logging Cookbook (GH-115325)
Also add more tests for LoggerAdapter.

Also support stacklevel in LoggerAdapter._log().
2024-02-12 18:24:45 +02:00
Vinay Sajip e21754d7f8
gh-114706: Allow QueueListener.stop() to be called more than once. (GH-114748) 2024-01-30 12:34:18 +00:00
Nikita Sobolev 8f5e7d739f
gh-108303: Move `smtpd` to `test.support` (#114368)
Update test_logging.py and test_smtplib.py.
2024-01-22 14:36:29 +01:00
Vinay Sajip 842b738129
gh-113692: skip a test if multiprocessing isn't available. (GH-113704) 2024-01-09 07:47:42 +00:00
Vinay Sajip 67655d8ad5
gh-111615: Fix regression in QueueHandler configuration. (GH-111638) 2023-12-27 09:35:15 +00:00
Vinay Sajip a5f29c9faf
gh-110875: Handle '.' properties in logging formatter configuration c… (GH-110943) 2023-11-09 18:55:22 +00:00
Victor Stinner f901f56313
gh-110656: Fix logging test_post_fork_child_no_deadlock() if ASAN (#110657)
Skip test_post_fork_child_no_deadlock() if Python is built with ASAN.

Add support.HAVE_ASAN_FORK_BUG.
2023-10-11 02:57:53 +02:00
Dale Collison 74723e1110
gh-109461: Update logging module lock to use context manager (#109462)
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-09-27 18:26:41 +02:00
Nikita Sobolev e57ecf6bbc
gh-108303: Move all certificates to `Lib/test/certdata/` (#109489) 2023-09-16 18:47:18 +02:00
Serhiy Storchaka 1e0d62793a
gh-108416: Mark slow but not CPU bound test methods with requires_resource('walltime') (GH-108480) 2023-09-05 17:56:30 +03:00
Peeyush Aggarwal 8d4052075e
gh-103384: Generalize the regex pattern `BaseConfigurator.INDEX_PATTERN` to allow spaces and non-alphanumeric characters in keys. (GH-103391)
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-08-25 09:15:26 +01:00
Romuald Brunet a482e5bf00
gh-76913: Add "merge extras" feature to LoggerAdapter (GH-107292) 2023-08-15 08:23:54 +01:00
Victor Stinner ed08238327
gh-107237: Fix test_udp_reconnection() of test_logging (#107238)
test_logging: Fix test_udp_reconnection() by increasing the timeout
from 100 ms to 5 minutes (LONG_TIMEOUT).

Replace also blocking wait() with wait(LONG_TIMEOUT) in
test_output() to prevent the test to hang.
2023-07-25 13:13:59 +00:00
Prince Roshan 12f1581b0c
gh-103606: raise RuntimeError if config file is invalid or empty (#104701)
(this adjusts new code) raise RuntimeError if provided config file is invalid or empty, not ValueError.
2023-05-20 22:26:49 +00:00
Prince Roshan 152227b569
gh-103606: Improve error message from logging.config.FileConfig (GH-103628) 2023-05-18 05:20:47 +01:00
Bar Harel 8f54302ab4
gh-103357: Add logging.Formatter defaults support to logging.config fileConfig and dictConfig (GH-103359) 2023-04-12 08:35:56 +01:00
Irit Katriel 482b6eeadc
gh-102799: use sys.exception() instead of sys.exc_info() in tests (#103293) 2023-04-06 11:08:25 +01:00
Gregory P. Smith d4c410f0f9
gh-84559: Remove the new multiprocessing warning, too disruptive. (#101551)
This reverts the core of #100618 while leaving relevant documentation
improvements and minor refactorings in place.
2023-02-03 15:20:46 -08:00
Gregory P. Smith 0ca67e6313
GH-84559: Deprecate fork being the multiprocessing default. (#100618)
This starts the process. Users who don't specify their own start method
and use the default on platforms where it is 'fork' will see a
DeprecationWarning upon multiprocessing.Pool() construction or upon
multiprocessing.Process.start() or concurrent.futures.ProcessPool use.

See the related issue and documentation within this change for details.
2023-02-02 15:50:35 -08:00
Nikita Sobolev e56e33d271
gh-72719: Remove asyncore and asynchat modules (#96580)
Remove modules asyncore and asynchat, which were deprecated by PEP 594.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-11-08 16:48:58 +01:00
Vinay Sajip ac4ddab405
gh-90195: Unset logger disabled flag when configuring it. (GH-96530) 2022-09-03 13:38:38 +01:00
Vinay Sajip 29f1b0bb1f
gh-89258: Add a getChildren() method to logging.Logger. (GH-96444)
Co-authored-by: Éric <merwok@netwok.org>
2022-08-31 10:50:29 +01:00
Vinay Sajip 6fbd889d6e
gh-89047: Fix msecs computation so you never end up with 1000 msecs. (GH-96340) 2022-08-27 13:33:24 +01:00
David Bonner 37c0f9ccc0
gh-95804: Respect MemoryHandler.flushOnClose in logging shutdown. (GH-95857) 2022-08-10 18:08:55 +01:00
Oleg Iarygin 56d16e8cb4
gh-93243: Make smtpd private before porting its users (GH-93246)
gh-93243

This PR is required to reduce diffs of the following porting (no need to either maintain documentation and tests consistent with each porting step, or try to port everything and remove smtpd in a single PR).

Automerge-Triggered-By: GH:warsaw
2022-08-05 17:41:29 -07:00
Erik Montnemery c60f125533
bpo-46755: Don't log stack info twice in QueueHandler (GH-31355) 2022-07-05 15:23:12 +01:00
Victor Stinner dba3fa57e2
gh-93761: Fix test_logging test_config_queue_handler() race condition (#93952)
Fix a race condition in test_config_queue_handler() of test_logging.
2022-06-19 11:49:35 +02:00
Victor Stinner c5b750dc0b
gh-93852: Add test.support.create_unix_domain_name() (#93914)
test_asyncio, test_logging, test_socket and test_socketserver now
create AF_UNIX domains in the current directory to no longer fail
with OSError("AF_UNIX path too long") if the temporary directory (the
TMPDIR environment variable) is too long.

Modify the following tests to use create_unix_domain_name():

* test_asyncio
* test_logging
* test_socket
* test_socketserver

test_asyncio.utils: remove unused time import.
2022-06-17 13:16:51 +02:00
Victor Stinner 538f28921f
test_logging: Fix BytesWarning in SysLogHandlerTest (GH-93920) 2022-06-17 09:09:54 +01:00