Issue #6240: Calls to logging.xxx() during collection causes all logging calls to be duplicated to stderr
(pytester: Pytester)
| 1638 | |
| 1639 | |
| 1640 | def test_logging_while_collecting(pytester: Pytester) -> None: |
| 1641 | """Issue #6240: Calls to logging.xxx() during collection causes all logging calls to be duplicated to stderr""" |
| 1642 | p = pytester.makepyfile( |
| 1643 | """\ |
| 1644 | import logging |
| 1645 | |
| 1646 | logging.warning("during collection") |
| 1647 | |
| 1648 | def test_logging(): |
| 1649 | logging.warning("during call") |
| 1650 | assert False |
| 1651 | """ |
| 1652 | ) |
| 1653 | result = pytester.runpytest_subprocess(p) |
| 1654 | assert result.ret == ExitCode.TESTS_FAILED |
| 1655 | result.stdout.fnmatch_lines( |
| 1656 | [ |
| 1657 | "*test_*.py F*", |
| 1658 | "====* FAILURES *====", |
| 1659 | "____*____", |
| 1660 | "*--- Captured log call*", |
| 1661 | "WARNING * during call", |
| 1662 | "*1 failed*", |
| 1663 | ] |
| 1664 | ) |
| 1665 | result.stdout.no_fnmatch_line("*Captured stderr call*") |
| 1666 | result.stdout.no_fnmatch_line("*during collection*") |
nothing calls this directly
no test coverage detected