From ed3f5613e38c741f352c829be0971a4f039b4a11 Mon Sep 17 00:00:00 2001 From: Padraic Shafer Date: Wed, 25 Oct 2023 12:47:59 -0700 Subject: [PATCH] Custom log level for TILED_DEBUG_LEAKED_THREADS --- tiled/_tests/conftest.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tiled/_tests/conftest.py b/tiled/_tests/conftest.py index 7bc76f147..e684ccb41 100644 --- a/tiled/_tests/conftest.py +++ b/tiled/_tests/conftest.py @@ -78,7 +78,7 @@ def tmpdir_module(request, tmpdir_factory): return tmpdir_factory.mktemp(request.module.__name__) -# Use this with pytest --log-cli-level=INFO option. +# Use this with pytest --log-cli-level=25 option. if os.getenv("TILED_DEBUG_LEAKED_THREADS"): import logging import threading @@ -86,9 +86,10 @@ def tmpdir_module(request, tmpdir_factory): def poll_enumerate(): logger = logging.getLogger(__name__) + msg_level = int(logging.INFO + logging.WARNING)//2 while True: time.sleep(1) - logger.info("THREAD COUNT = %d", len(threading.enumerate())) + logger.log(msg_level, "THREAD COUNT = %d", len(threading.enumerate())) thread = threading.Thread(target=poll_enumerate, daemon=True) thread.start()