summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_logging.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.9] bpo-46411: Remove unnecessary calls to sys.exc_info() in tests ↵Miss Islington (bot)2022-01-181-2/+2
| | | | | | | | | | (GH-30638) (GH-30658) (cherry picked from commit a287b31bcb065e4122400cb59167340d25480e6d) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Automerge-Triggered-By: GH:iritkatriel
* [3.9] bpo-46063: Add 'delay=True' to file handler initialization. (GH-30103) ↵Miss Islington (bot)2021-12-141-1/+2
| | | | (GH-30105)
* [3.9] bpo-46063: Improve algorithm for computing which rolled-over log ↵Miss Islington (bot)2021-12-141-2/+50
| | | | file… (GH-30093) (GH-30095)
* bpo-45401: Fix a resource warning in test_logging (GH-28864) (GH-28873)Miss Islington (bot)2021-10-121-0/+1
| | | | | | (cherry picked from commit 15188b115a2da815556053372c912a81a74be43b) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-45401: Change shouldRollover() methods to only rollover regular f… ↵Miss Islington (bot)2021-10-111-0/+15
| | | | | | | | | | | | (GH-28822) (#28866) …iles. Also changed some historical return values from 1 -> True and 0 -> False. (cherry picked from commit 62a667784ba7b84611ebd50fa8a1a464cde32235) Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk> Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
* [3.9] bpo-45229: Remove test_main in many tests (GH-28405) (GH-28456)Serhiy Storchaka2021-09-201-20/+6
| | | | | | | | | | | Instead of explicitly enumerate test classes for run_unittest() use the unittest ability to discover tests. This also makes these tests discoverable and runnable with unittest. load_tests() can be used for dynamic generating tests and adding doctests. setUpModule(), tearDownModule() and addModuleCleanup() can be used for running code before and after all module tests.. (cherry picked from commit 40348acc180580371d25f75f46b27048e35f2435)
* bpo-43961: Fix test_logging.test_namer_rotator_inheritance() (GH-25684) ↵Miss Islington (bot)2021-04-281-1/+1
| | | | | | | | | | | (GH-25688) Fix test_logging.test_namer_rotator_inheritance() on Windows: use os.replace() rather than os.rename(). (cherry picked from commit fe52eb62191e640e720d184a9a1a04e965b8a062) Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-43842: Fix race condition in test_logging SMTP test (GH-25436) (GH-25437)Victor Stinner2021-04-161-2/+5
| | | | | | | Fix a race condition in the SMTP test of test_logging. Don't close a file descriptor (socket) from a different thread while asyncore.loop() is polling the file descriptor. (cherry picked from commit 75ec103b3adbb7c619a0e22fa60f3d34c5a9e603)
* bpo-42644: Validate values in logging.disable() (GH-23786)Miss Islington (bot)2020-12-161-0/+9
| | | | | | | | | | | | | | | | | | | | | | * bpo-42644: Validate values in logging.disable() Technically make the value of manager a property that checks and convert values assigned to it properly. This has the side effect of making `logging.disable` also accept strings representing the various level of warnings. We want to validate the type of the disable attribute at assignment time, as it is later compared to other levels when emitting warnings and would generate a `TypeError: '>=' not supported between ....` in a different part of the code base, which can make it difficult to track down. When assigned an incorrect value; it will raise a TypeError when the wrong type, or ValueError if an invalid str. Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com> (cherry picked from commit b32d8b4f9bcd2e7d11240b6b9de0262cf8f5e09d) Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
* bpo-41739: Fix test_logging.test_race_between_set_target_and_flush() ↵Victor Stinner2020-10-121-8/+13
| | | | | | | | | | (GH-22655) (GH-22656) The test now waits until all threads complete to avoid leaking running threads. Also, use regular threads rather than daemon threads. (cherry picked from commit 13ff396c019d548ba181cf22c6f39309a300723c)
* [3.9] bpo-41503: Fix race between setTarget and flush in ↵Miss Islington (bot)2020-08-161-0/+21
| | | | | | | | | | logging.handlers.MemoryHandler (GH-21765) (GH-21897) (cherry picked from commit 2353d77fad7ed9d11d8a4d66b5dd1306cdb94125) Co-authored-by: Irit Katriel <iritkatriel@yahoo.com> Automerge-Triggered-By: @vsajip
* bpo-38377: Add support.skip_if_broken_multiprocessing_synchronize() ↵Victor Stinner2020-06-181-4/+4
| | | | | | | | | | (GH-20944) (GH-20962) On Linux, skip tests using multiprocessing if the current user cannot create a file in /dev/shm/ directory. Add the skip_if_broken_multiprocessing_synchronize() function to the test.support module. (cherry picked from commit ddbeb2f3e02a510c5784ffd74c5e09e8c70b5881)
* bpo-40275: More lazy imports in test.support (GH-20131)Hai Shi2020-05-181-1/+1
| | | | | | | | | | | | | | | | | | | Make the the following imports lazy in test.support: * bz2 * gzip * lzma * resource * zlib The following test.support decorators now need to be called with parenthesis: * @support.requires_bz2 * @support.requires_gzip * @support.requires_lzma * @support.requires_zlib For example, "@requires_zlib" becomes "@requires_zlib()".
* bpo-40443: Remove unused imports in tests (GH-19804)Victor Stinner2020-04-301-1/+0
|
* bpo-40275: Avoid importing logging in test.support (GH-19601)Serhiy Storchaka2020-04-251-2/+3
| | | | | Import logging lazily in assertLogs() in unittest. Move TestHandler from test.support to logging_helper.
* bpo-40275: Avoid importing socket in test.support (GH-19603)Serhiy Storchaka2020-04-251-3/+4
| | | | | | * Move socket related functions from test.support to socket_helper. * Import socket, nntplib and urllib.error lazily in transient_internet(). * Remove importing multiprocess.
* bpo-40300: Allow empty logging.Formatter.default_msec_format. (GH-19551)Mariusz Felisiak2020-04-171-0/+13
|
* bpo-40094: Add test.support.wait_process() (GH-19254)Victor Stinner2020-03-311-17/+6
| | | | | | | | | Moreover, the following tests now check the child process exit code: * test_os.PtyTests * test_mailbox.test_lock_conflict() * test_tempfile.test_process_awareness() * test_uuid.testIssue8621() * multiprocessing resource tracker tests
* bpo-39489: Remove COUNT_ALLOCS special build (GH-18259)Victor Stinner2020-02-031-1/+0
| | | | | | | | | | | Remove: * COUNT_ALLOCS macro * sys.getcounts() function * SHOW_ALLOC_COUNT code in listobject.c * SHOW_TRACK_COUNT code in tupleobject.c * PyConfig.show_alloc_count field * -X showalloccount command line option * @test.support.requires_type_collecting decorator
* bpo-39142: Avoid converting namedtuple instances to ConvertingTuple. (GH-17773)Vinay Sajip2020-01-011-0/+31
| | | | | | | This uses the heuristic of assuming a named tuple is a subclass of tuple with a _fields attribute. This change means that contents of a named tuple wouldn't be converted - if a user wants to have ConvertingTuple functionality from a namedtuple, they will have to implement it themselves.
* bpo-38614: Use test.support.LONG_TIMEOUT constant (GH-17562)Victor Stinner2019-12-101-2/+2
| | | | | | | | Replace hardcoded timeout constants in tests with LONG_TIMEOUT of test.support, so it's easier to ajdust this timeout for all tests at once. LONG_TIMEOUT is 5 minutes by default, but it can be longer depending on --timeout command line option.
* bpo-38614: Use default join_thread() timeout in tests (GH-17559)Victor Stinner2019-12-101-16/+10
| | | | | Tests no longer pass a timeout value to join_thread() of test.support: use the default join_thread() timeout instead (SHORT_TIMEOUT constant of test.support).
* update a deprecated assert in logging tests (GH-17079)l0rb2019-11-071-1/+1
|
* bpo-38716: stop rotating handlers from setting inherited namer and rotator ↵l0rb2019-11-061-0/+19
| | | | to None (GH-17072)
* bpo-38586: setting logging.Handler .name property in fileConfig (GH-16918)Lucas Cimon2019-10-311-0/+24
|
* Updated incorrect level-setting code to use setLevel(). (GH-16325)Vinay Sajip2019-09-221-1/+1
|
* bpo-37742: Return the root logger when logging.getLogger('root') is c… ↵Vinay Sajip2019-08-021-0/+1
| | | | | | | | (#15077) * bpo-37742: Return the root logger when logging.getLogger('root') is called. * Added type check guard on logger name in logging.getLogger() and refined a test.
* bpo-37258: Not a bug, but added a unit test and updated documentation. ↵Vinay Sajip2019-06-191-0/+31
| | | | (GH-14229)
* bpo-37111: Add 'encoding' and 'errors' parameters to logging.basicCon… ↵Vinay Sajip2019-06-171-2/+95
| | | | (GH-14008)
* bpo-36813: Fix QueueListener to call task_done() upon termination. (GH-13113)Bar Harel2019-06-011-0/+10
| | | | | | | | Fixed QueueListener in order to avoid random deadlocks. Unable to add regression tests atm due to time constraints, will add it in a bit. Regarding implementation, although it's nested, it does not cause performance issues whatsoever, and does not call task_done() in case of an exception (which is the right thing to do IMHO). https://bugs.python.org/issue36813
* bpo-36903: Fix ResourceWarning in test_logging (GH-13283)Xtreak2019-05-131-0/+1
|
* bpo-36015: Handle StreamHandler representaton of stream with an integer name ↵Riccardo Magliocchetti2019-05-071-0/+8
| | | | (GH-11908)
* bpo-36533: Reinit logging.Handler locks on fork(). (GH-12704)Gregory P. Smith2019-05-071-4/+27
| | | | | Instead of attempting to acquire and release them all across fork which was leading to deadlocks in some applications that had chained their own handlers while holding multiple locks.
* bpo-36681: Remove duplicate test_regression_29220 function (GH-12894)Windson yang2019-04-221-6/+0
|
* bpo-35726: Add test for QueueHandler with multiple handlers (GH-11659)Xtreak2019-04-071-0/+13
|
* bpo-36272: Logging now propagates RecursionError (GH-12312)Rémi Lapeyre2019-03-151-1/+16
|
* bpo-34997: Fix test_logging.ConfigDictTest.test_out_of_order (GH-9913)Pablo Galindo2018-10-161-1/+2
| | | | | | | | When runnint test_logging with --huntrleaks after commit 18fb1fb943b7dbd7f8a76017ee2a67ef13effb85, test_out_of_order fails to raise ValueError due to the fact that the new test test_out_of_order_with_dollar_style mutates the out_of_order dictionary. Even if the test copies the dictionary first, the mutation is done in a very deep level so the original one is also affected.
* bpo-34844: logging.Formatter enhancement - Ensure style and format string ↵BNMetrics2018-10-151-16/+316
| | | | matches in logging.Formatter (GH-9703)
* bpo-34334: Don't log traceback twice in QueueHandler (GH-9537)Cheryl Sabella2018-09-251-0/+15
|
* bpo-6721: Hold logging locks across fork() (GH-4071)Gregory P. Smith2018-09-141-0/+67
| | | | | | | | | bpo-6721: When os.fork() was called while another thread holds a logging lock, the child process may deadlock when it tries to log. This fixes that by acquiring all logging locks before fork and releasing them afterwards. A regression test that fails before this change is included. Within the new unittest itself: There is a small _potential_ due to mixing of fork and a thread in the child process if the parent's thread happened to hold a non-reentrant library call lock (malloc?) when the os.fork() happens. buildbots and time will tell if this actually manifests itself in this test or not. :/ A functionality test that avoids that would be a challenge. An alternate test that isn't trying to produce the deadlock itself but just checking that the release and acquire calls are made would be the next best alternative if so.
* bpo-34092, test_logging: increase SMTPHandlerTest timeout (GH-8245)Victor Stinner2018-07-111-2/+3
| | | | | Change test_logging.SMTPHandlerTest timeout from 8 seconds to 1 minute. The test failed randomly on the slow x86 Gentoo Refleaks 3.7 buildbot.
* bpo-33978: Close existing handlers before logging (re-)configuration. (GH-8008)Xtreak2018-07-021-0/+75
|
* bpo-33897: Add a 'force' keyword argument to logging.basicConfig(). (GH-7873)Dong-hee Na2018-06-251-0/+21
|
* bpo-33802: Do not interpolate in ConfigParser while reading defaults (GH-7524)Łukasz Langa2018-06-081-0/+43
| | | This solves a regression in logging config due to changes in BPO-23835.
* bpo-33165: Added stacklevel parameter to logging APIs. (GH-7424)Vinay Sajip2018-06-051-0/+31
|
* bpo-33606: improve logging performance when logger is disabled (GH-7285)Timo Furrer2018-06-011-0/+12
| | | A check has been added in Logger.isEnabledFor() to return False when the logger is disabled. This avoids unnecessary work being done when a disabled logger is used.
* bpo-32593: Drop FreeBSD 9 and older support (#5232)Victor Stinner2018-01-221-8/+1
| | | Drop support of FreeBSD 9 and older.
* bpo-32297: Few misspellings found in Python source code comments. (#4803)Mike2017-12-141-25/+25
| | | | | | | | * Fix multiple typos in code comments * Add spacing in comments (test_logging.py, test_math.py) * Fix spaces at the beginning of comments in test_logging.py
* bpo-28668: test.support.requires_multiprocessing_queue is removed (GH-4560)xdegaye2017-12-011-2/+6
| | | | Skip tests with test.support.import_module('multiprocessing.synchronize') instead when the semaphore implementation is broken or missing.
* bpo-31457: Don't omit inner ``process()`` calls with nested LogAdapters (#4044)Łukasz Langa2017-10-191-6/+14
| | | | | | | | | | | This used to be the case on Python 2. Commit 212b590e118e3650b596917021ed9612a918180b changed the implementation for Python 3, making the `log()` method of LogAdapter call `logger._log()` directly. This makes nested log adapters not execute their ``process()`` method. This patch fixes the issue. Also, now proxying `name`, too, to make `repr()` work with nested log adapters. New tests added.