MCPcopy Index your code
hub / github.com/python/mypy / test_daemon

Function test_daemon

mypy/test/testdaemon.py:38–55  ·  view source on GitHub ↗
(testcase: DataDrivenTestCase)

Source from the content-addressed store, hash-verified

36
37
38def test_daemon(testcase: DataDrivenTestCase) -> None:
39 assert testcase.old_cwd is not None, "test was not properly set up"
40 for i, step in enumerate(parse_script(testcase.input)):
41 cmd = step[0]
42 expected_lines = step[1:]
43 assert cmd.startswith("$")
44 cmd = cmd[1:].strip()
45 cmd = cmd.replace("{python}", sys.executable)
46 sts, output = run_cmd(cmd)
47 output_lines = output.splitlines()
48 output_lines = normalize_error_messages(output_lines)
49 if sts:
50 output_lines.append("== Return code: %d" % sts)
51 assert_string_arrays_equal(
52 expected_lines,
53 output_lines,
54 "Command %d (%s) did not give expected output" % (i + 1, cmd),
55 )
56
57
58def parse_script(input: list[str]) -> list[list[str]]:

Callers 1

run_caseMethod · 0.85

Calls 10

normalize_error_messagesFunction · 0.90
enumerateFunction · 0.85
parse_scriptFunction · 0.85
stripMethod · 0.80
replaceMethod · 0.80
splitlinesMethod · 0.80
appendMethod · 0.80
run_cmdFunction · 0.70
startswithMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…