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

Function test_unicode

testing/test_warnings.py:127–150  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

125
126@pytest.mark.filterwarnings("always::UserWarning")
127def test_unicode(pytester: Pytester) -> None:
128 pytester.makepyfile(
129 """
130 import warnings
131 import pytest
132
133
134 @pytest.fixture
135 def fix():
136 warnings.warn("测试")
137 yield
138
139 def test_func(fix):
140 pass
141 """
142 )
143 result = pytester.runpytest()
144 result.stdout.fnmatch_lines(
145 [
146 "*== %s ==*" % WARNINGS_SUMMARY_HEADER,
147 "*test_unicode.py:7: UserWarning: \u6d4b\u8bd5*",
148 "* 1 passed, 1 warning*",
149 ]
150 )
151
152
153def test_works_with_filterwarnings(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected