MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_encoding

Method test_encoding

testing/test_doctest.py:159–180  ·  view source on GitHub ↗

Test support for doctest_encoding ini option.

(self, pytester, test_string, encoding)

Source from the content-addressed store, hash-verified

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(

Callers

nothing calls this directly

Calls 4

fnmatch_linesMethod · 0.80
makeiniMethod · 0.45
formatMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected