def run_case(self, testcase: DataDrivenTestCase) -> None: first_src = '\n'.join(testcase.input) files_dict = dict(testcase.files) second_src = files_dict['tmp/next.py'] messages1, files1 = self.build(first_src) messages2, files2 = self.build(second_src) a = [] if messages1: a.extend(messages1) if messages2: a.append('== next ==') a.extend(messages2) assert files1 is not None and files2 is not None, ( 'cases where CompileError' ' occurred should not be run') diff = compare_symbol_tables('__main__', files1['__main__'].names, files2['__main__'].names) for trigger in sorted(diff): a.append(trigger) assert_string_arrays_equal( testcase.output, a, 'Invalid output ({}, line {})'.format(testcase.file, testcase.line))
def calculate_active_triggers(manager: BuildManager, old_modules: Dict[str, MypyFile], new_modules: Dict[str, MypyFile]) -> Set[str]: """Determine activated triggers by comparing old and new symbol tables. For example, if only the signature of function m.f is different in the new symbol table, return {'<m.f>'}. """ names = set() # type: Set[str] for id in new_modules: names |= compare_symbol_tables(id, old_modules[id].names, new_modules[id].names) return {make_trigger(name) for name in names}