MCPcopy
hub / github.com/python/mypy / run_case

Method run_case

mypyc/test/test_capsule_deps.py:29–55  ·  view source on GitHub ↗
(self, testcase: DataDrivenTestCase)

Source from the content-addressed store, hash-verified

27 base_path = test_temp_dir
28
29 def run_case(self, testcase: DataDrivenTestCase) -> None:
30 options = infer_ir_build_options_from_test_name(testcase.name)
31 if options is None:
32 # Skipped test case
33 return
34 with use_custom_builtins(os.path.join(self.data_prefix, ICODE_GEN_BUILTINS), testcase):
35 try:
36 module_ir, _, _, _ = build_ir_for_single_file2(testcase.input, options)
37 except CompileError as e:
38 actual = e.messages
39 else:
40 all_deps: set[str] = set()
41 for fn in module_ir.functions:
42 compiler_options = CompilerOptions()
43 lower_ir(fn, compiler_options)
44 deps = find_implicit_op_dependencies(fn)
45 if deps:
46 for dep in deps:
47 all_deps.add(repr(dep))
48 for cl in module_ir.classes:
49 deps = find_class_dependencies(cl)
50 if deps:
51 for dep in deps:
52 all_deps.add(repr(dep))
53 actual = sorted(all_deps) if all_deps else ["No deps"]
54
55 assert_test_output(testcase, actual, "Invalid test output", testcase.output)

Callers

nothing calls this directly

Calls 13

use_custom_builtinsFunction · 0.90
CompilerOptionsClass · 0.90
lower_irFunction · 0.90
find_class_dependenciesFunction · 0.90
assert_test_outputFunction · 0.90
setClass · 0.85
reprFunction · 0.85
sortedFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected