MCPcopy Index your code
hub / github.com/python/cpython / infocmp

Method infocmp

Lib/test/test_pyrepl/test_terminfo.py:60–85  ·  view source on GitHub ↗
(cls, term)

Source from the content-addressed store, hash-verified

58
59 @classmethod
60 def infocmp(cls, term) -> list[str]:
61 all_caps = []
62 try:
63 result = subprocess.run(
64 ["infocmp", "-l1", term],
65 capture_output=True,
66 text=True,
67 check=True,
68 )
69 except Exception:
70 raise unittest.SkipTest("calling `infocmp` failed on the system")
71
72 for line in result.stdout.splitlines():
73 line = line.strip()
74 if line.startswith("#"):
75 if "terminfo" not in line and "termcap" in line:
76 # PyREPL terminfo doesn't parse termcap databases
77 raise unittest.SkipTest(
78 "curses using termcap.db: no terminfo database on"
79 " the system"
80 )
81 elif "=" in line:
82 cap_name = line.split("=")[0]
83 all_caps.append(cap_name)
84
85 return all_caps
86
87 def test_setupterm_basic(self):
88 """Test basic setupterm functionality."""

Callers 3

setUpClassMethod · 0.80

Calls 6

runMethod · 0.45
splitlinesMethod · 0.45
stripMethod · 0.45
startswithMethod · 0.45
splitMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected