def flag_value(flag, spec): compiler = None if spec is None: compiler = MockCompiler() else: compiler_entry = copy(default_compiler_entry) compiler_entry['spec'] = spec compiler = compilers.compiler_from_dict(compiler_entry) return getattr(compiler, flag)
def test_compiler_flags_from_config_are_grouped(): compiler_entry = { 'spec': '[email protected]', 'operating_system': 'foo-os', 'paths': { 'cc': 'cc-path', 'cxx': 'cxx-path', 'fc': None, 'f77': None }, 'flags': { 'cflags': '-O0 -foo-flag foo-val' }, 'modules': None } compiler = compilers.compiler_from_dict(compiler_entry) assert any(x == '-foo-flag foo-val' for x in compiler.flags['cflags'])