def test_failed_translate_compiler_name(): unknown_compiler = JsonCompilerEntry(name='unknown', version='1.0') with pytest.raises(spack.compilers.UnknownCompilerError): compiler_from_entry(unknown_compiler.compiler_json()) spec_json = JsonSpecEntry(name='packagey', hash='hash-of-y', prefix='/path/to/packagey-install/', version='1.0', arch=_common_arch, compiler=unknown_compiler.spec_json(), dependencies={}, parameters={}).to_dict() with pytest.raises(spack.compilers.UnknownCompilerError): entries_to_specs([spec_json])
def test_spec_conversion(): """Given JSON entries, check that we can form a set of Specs including dependency references. """ entries = list(x.to_dict() for x in generate_openmpi_entries()) specs = entries_to_specs(entries) openmpi_spec, = list(x for x in specs.values() if x.name == 'openmpi') assert openmpi_spec['hwloc']
def test_translate_compiler_name(): nvidia_compiler = JsonCompilerEntry(name='nvidia', version='19.1', executables={ "cc": "/path/to/compiler/nvc", "cxx": "/path/to/compiler/nvc++", }) compiler = compiler_from_entry(nvidia_compiler.compiler_json()) assert compiler.name == 'nvhpc' spec_json = JsonSpecEntry(name='hwloc', hash='hwlocfakehashaaa', prefix='/path/to/hwloc-install/', version='2.0.3', arch=_common_arch, compiler=nvidia_compiler.spec_json(), dependencies={}, parameters={}).to_dict() spec, = entries_to_specs([spec_json]).values() assert spec.compiler.name == 'nvhpc'