(pytester: Pytester)
| 146 | |
| 147 | |
| 148 | def test_teardown_logging(pytester: Pytester) -> None: |
| 149 | pytester.makepyfile( |
| 150 | """ |
| 151 | import logging |
| 152 | |
| 153 | logger = logging.getLogger(__name__) |
| 154 | |
| 155 | def test_foo(): |
| 156 | logger.info('text going to logger from call') |
| 157 | |
| 158 | def teardown_function(function): |
| 159 | logger.info('text going to logger from teardown') |
| 160 | assert False |
| 161 | """ |
| 162 | ) |
| 163 | result = pytester.runpytest("--log-level=INFO") |
| 164 | assert result.ret == 1 |
| 165 | result.stdout.fnmatch_lines( |
| 166 | [ |
| 167 | "*- Captured *log call -*", |
| 168 | "*text going to logger from call*", |
| 169 | "*- Captured *log teardown -*", |
| 170 | "*text going to logger from teardown*", |
| 171 | ] |
| 172 | ) |
| 173 | |
| 174 | |
| 175 | @pytest.mark.parametrize("enabled", [True, False]) |
nothing calls this directly
no test coverage detected