tqdm/tests
Steffan Karger f99bcb479b logging: inherit output stream from existing handler
When using the logging redirection, logs will currently always be printed
to stdout, while the logging module default is to print to stderr.

Fix this by trying to inherit the stream from the existing handler, like
the code already does for the formatter.

Consider the following example:

    import logging
    import time

    from tqdm.contrib.logging import tqdm_logging_redirect

    log = logging.getLogger()
    log.warning("start")

    with tqdm_logging_redirect(range(int(4))) as pbar:
        for i in pbar:
            time.sleep(0.1)
            log.warning(f"Step {i}")

    log.warning("done")

Running this while redirecting stdout (`$ python3 log.py > /dev/null`)
without this patch will print:

    $ venv/bin/python log.py > /dev/null
    start
    100%|████████████████████████████████████████████| 4/4 [00:00<00:00,  9.87it/s]
    done

After this patch:

    $ venv/bin/python log.py > /dev/null
    start
    Step 0
    Step 1
    Step 2
    Step 3
    100%|████████████████████████████████████████████| 4/4 [00:00<00:00,  9.83it/s]
    done

Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
2021-08-14 21:16:54 +01:00
..
__init__.py move tests directory to external module 2020-10-24 22:12:21 +01:00
conftest.py format: isort 2021-01-09 17:00:18 +00:00
py37_asyncio.py `asyncio.gather` API consistency with stdlib 2021-07-30 21:33:05 +01:00
tests_asyncio.py tests: lots of tidying 2021-01-04 03:32:03 +00:00
tests_concurrent.py format: isort 2021-01-09 17:00:18 +00:00
tests_contrib.py Fix flake8 2021-03-16 18:59:55 +01:00
tests_contrib_logging.py logging: inherit output stream from existing handler 2021-08-14 21:16:54 +01:00
tests_dask.py tests: test kwargs for `keras`, `dask` 2021-03-05 14:13:33 +00:00
tests_gui.py tests: gui & tk import 2021-01-10 18:08:06 +00:00
tests_itertools.py format: isort 2021-01-09 17:00:18 +00:00
tests_keras.py keras: fix resume from `initial_epoch` 2021-05-03 01:00:11 +01:00
tests_main.py lint: fix some warnings 2021-02-22 22:42:24 +00:00
tests_notebook.py test:cleanup pytest config 2020-12-24 22:22:52 +00:00
tests_pandas.py format: isort 2021-01-09 17:00:18 +00:00
tests_perf.py format: isort 2021-01-09 17:00:18 +00:00
tests_rich.py add `rich` 2021-01-10 23:49:17 +00:00
tests_synchronisation.py format: isort 2021-01-09 17:00:18 +00:00
tests_tk.py tests: gui & tk import 2021-01-10 18:08:06 +00:00
tests_tqdm.py rename `waituntil` => `delay` 2021-02-25 16:08:12 +00:00
tests_version.py format: isort 2021-01-09 17:00:18 +00:00