def test_unset_config(self): classpath = java_config['classpath'] options = java_config['options'] java_config['classpath'] = None with tempfile.NamedTemporaryFile() as output_file: execute_parser(INPUT_PATH, pathlib.Path(output_file.name)) self.assertIsNone(java_config['classpath']) java_config['classpath'] = classpath java_config['options'] = options
def test_unset_config(self): classpath = java_config['classpath'] options = java_config['options'] input_path = pathlib.Path('test', 'examples', 'empty.f') java_config['classpath'] = None with tempfile.NamedTemporaryFile() as output_file: execute_parser(input_path, pathlib.Path(output_file.name)) java_config['classpath'] = classpath java_config['options'] = options
def test_execute_parser_stdout(self): for input_path in SOME_INPUT_PATHS: for verbosity in SOME_VERBOSITIES: with self.subTest(input_path=input_path, verbosity=verbosity): process = execute_parser(input_path, None, verbosity) self.assertEqual(process.returncode, 0) fortran_ast = ET.fromstring(process.stdout) self._validate_tree(fortran_ast)
def test_generate_xml_large(self): results_path = pathlib.Path(_HERE, 'results', 'examples') results_path.mkdir(exist_ok=True) for input_path in INPUT_PATHS_LARGE: for verbosity in VERBOSITIES: with self.subTest(input_path=input_path, verbosity=verbosity): output_path = pathlib.Path(results_path, input_path.name + '.xml') process = execute_parser(input_path, output_path, verbosity) self.assertEqual(process.returncode, 0) self.assertTrue(output_path.exists())
def test_generate_xml(self): results_path = pathlib.Path(_HERE, 'results', 'examples') results_path.mkdir(exist_ok=True) for input_path in INPUT_PATHS: for verbosity in VERBOSITIES: with self.subTest(input_path=input_path, verbosity=verbosity): output_path = results_path.joinpath( '{}.{}.xml'.format(input_path.name, verbosity)) process = execute_parser(input_path, output_path, verbosity) self.assertEqual(process.returncode, 0, process) self.assertTrue(output_path.exists())