(pytester: Pytester)
| 890 | |
| 891 | |
| 892 | def test_log_file_unicode(pytester: Pytester) -> None: |
| 893 | log_file = str(pytester.path.joinpath("pytest.log")) |
| 894 | |
| 895 | pytester.makeini( |
| 896 | f""" |
| 897 | [pytest] |
| 898 | log_file={log_file} |
| 899 | log_file_level = INFO |
| 900 | """ |
| 901 | ) |
| 902 | pytester.makepyfile( |
| 903 | """\ |
| 904 | import logging |
| 905 | |
| 906 | def test_log_file(): |
| 907 | logging.getLogger('catchlog').info("Normal message") |
| 908 | logging.getLogger('catchlog').info("├") |
| 909 | logging.getLogger('catchlog').info("Another normal message") |
| 910 | """ |
| 911 | ) |
| 912 | |
| 913 | result = pytester.runpytest() |
| 914 | |
| 915 | # make sure that we get a '0' exit code for the testsuite |
| 916 | assert result.ret == 0 |
| 917 | assert os.path.isfile(log_file) |
| 918 | with open(log_file, encoding="utf-8") as rfh: |
| 919 | contents = rfh.read() |
| 920 | assert "Normal message" in contents |
| 921 | assert "├" in contents |
| 922 | assert "Another normal message" in contents |
| 923 | |
| 924 | |
| 925 | @pytest.mark.parametrize("has_capture_manager", [True, False]) |
nothing calls this directly
no test coverage detected