MCPcopy
hub / github.com/pytest-dev/pytest / test_libedit_workaround

Function test_libedit_workaround

testing/test_capture.py:1746–1772  ·  testing/test_capture.py::test_libedit_workaround
(pytester: Pytester)

Source from the content-addressed store, hash-verified

1744
1745
1746def test_libedit_workaround(pytester: Pytester) -> None:
1747 pytester.makeconftest(class="st">"""
1748 import pytest
1749
1750
1751 def pytest_terminal_summary(config):
1752 capture = config.pluginmanager.getplugin(class="st">"capturemanager")
1753 capture.suspend_global_capture(in_=True)
1754
1755 print(class="st">"Enter &class="cm">#x27;hi'")
1756 value = input()
1757 print(fclass="st">"value: {value!r}")
1758
1759 capture.resume_global_capture()
1760 class="st">""")
1761 readline = pytest.importorskip(class="st">"readline")
1762 backend = getattr(readline, class="st">"backend", readline.__doc__) class="cm"># added in Python 3.13
1763 print(fclass="st">"Readline backend: {backend}")
1764
1765 child = pytester.spawn_pytest(class="st">"")
1766 child.expect(rclass="st">"Enter &class="cm">#x27;hi'")
1767 child.sendline(class="st">"hi")
1768 rest = child.read().decode(class="st">"utf8")
1769 print(rest)
1770 match = re.search(rclass="st">"^value: &class="cm">#x27;(.*)'\r?$", rest, re.MULTILINE)
1771 assert match is not None
1772 assert match.group(1) == class="st">"hi"

Callers

nothing calls this directly

Calls 4

groupMethod · 0.80
makeconftestMethod · 0.45
spawn_pytestMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected