Test support for doctest_encoding ini option.
(self, pytester, test_string, encoding)
| 157 | [("foo", "ascii"), ("öäü", "latin1"), ("öäü", "utf-8")], |
| 158 | ) |
| 159 | def test_encoding(self, pytester, test_string, encoding): |
| 160 | """Test support for doctest_encoding ini option.""" |
| 161 | pytester.makeini( |
| 162 | """ |
| 163 | [pytest] |
| 164 | doctest_encoding={} |
| 165 | """.format( |
| 166 | encoding |
| 167 | ) |
| 168 | ) |
| 169 | doctest = """ |
| 170 | >>> "{}" |
| 171 | {} |
| 172 | """.format( |
| 173 | test_string, repr(test_string) |
| 174 | ) |
| 175 | fn = pytester.path / "test_encoding.txt" |
| 176 | fn.write_text(doctest, encoding=encoding) |
| 177 | |
| 178 | result = pytester.runpytest() |
| 179 | |
| 180 | result.stdout.fnmatch_lines(["*1 passed*"]) |
| 181 | |
| 182 | def test_doctest_unexpected_exception(self, pytester: Pytester): |
| 183 | pytester.maketxtfile( |
nothing calls this directly
no test coverage detected