(pytester: Pytester)
| 784 | |
| 785 | |
| 786 | def test_log_file_unicode(pytester: Pytester) -> None: |
| 787 | log_file = str(pytester.path.joinpath("pytest.log")) |
| 788 | |
| 789 | pytester.makeini( |
| 790 | """ |
| 791 | [pytest] |
| 792 | log_file={} |
| 793 | log_file_level = INFO |
| 794 | """.format( |
| 795 | log_file |
| 796 | ) |
| 797 | ) |
| 798 | pytester.makepyfile( |
| 799 | """\ |
| 800 | import logging |
| 801 | |
| 802 | def test_log_file(): |
| 803 | logging.getLogger('catchlog').info("Normal message") |
| 804 | logging.getLogger('catchlog').info("├") |
| 805 | logging.getLogger('catchlog').info("Another normal message") |
| 806 | """ |
| 807 | ) |
| 808 | |
| 809 | result = pytester.runpytest() |
| 810 | |
| 811 | # make sure that we get a '0' exit code for the testsuite |
| 812 | assert result.ret == 0 |
| 813 | assert os.path.isfile(log_file) |
| 814 | with open(log_file, encoding="utf-8") as rfh: |
| 815 | contents = rfh.read() |
| 816 | assert "Normal message" in contents |
| 817 | assert "├" in contents |
| 818 | assert "Another normal message" in contents |
| 819 | |
| 820 | |
| 821 | @pytest.mark.parametrize("has_capture_manager", [True, False]) |
nothing calls this directly
no test coverage detected