message_ix_models.tests.util.test_logging.TestQueueListener
- class message_ix_models.tests.util.test_logging.TestQueueListener[source]
Bases:
object
- __init__()
Methods
__init__
()test_flush
(caplog, mix_models_cli, method, k)Test logging in multiple processes, multiple threads, and with
click
.Attributes
Number of log messages to emit.
Number of times to run the test.
- N = 1000
Number of log messages to emit.
- k = 4
Number of times to run the test.
- test_flush(caplog, mix_models_cli, method, k)[source]
Test logging in multiple processes, multiple threads, and with
click
.With pytest-xdist, these
k
test cases will run in multiple processes. Each process will have its main thread, and the thread of the QueueListener. The test ensures that allN
log records emitted by thefunc()
are “flushed” from the queue, transferred to stdout by theStreamHandler
and captured by theCliRunner
.