unit test : prerequisites

This commit is contained in:
alalazo 2016-06-04 17:24:27 +02:00
parent ffa6fed3a3
commit 2d6db06fca

View File

@ -68,6 +68,24 @@ def mock_open(filename, mode):
} }
} }
configuration_prerequisites_direct = {
'enable': ['tcl'],
'tcl': {
'all': {
'prerequisites': 'direct'
}
}
}
configuration_prerequisites_all = {
'enable': ['tcl'],
'tcl': {
'all': {
'prerequisites': 'all'
}
}
}
configuration_alter_environment = { configuration_alter_environment = {
'enable': ['tcl'], 'enable': ['tcl'],
'tcl': { 'tcl': {
@ -187,6 +205,17 @@ def test_autoload(self):
self.assertEqual(len([x for x in content if 'is-loaded' in x]), 5) self.assertEqual(len([x for x in content if 'is-loaded' in x]), 5)
self.assertEqual(len([x for x in content if 'module load ' in x]), 5) self.assertEqual(len([x for x in content if 'module load ' in x]), 5)
def test_prerequisites(self):
spack.modules.CONFIGURATION = configuration_prerequisites_direct
spec = spack.spec.Spec('mpileaks arch=x86-linux')
content = self.get_modulefile_content(spec)
self.assertEqual(len([x for x in content if 'prereq' in x]), 2)
spack.modules.CONFIGURATION = configuration_prerequisites_all
spec = spack.spec.Spec('mpileaks arch=x86-linux')
content = self.get_modulefile_content(spec)
self.assertEqual(len([x for x in content if 'prereq' in x]), 5)
def test_alter_environment(self): def test_alter_environment(self):
spack.modules.CONFIGURATION = configuration_alter_environment spack.modules.CONFIGURATION = configuration_alter_environment
spec = spack.spec.Spec('mpileaks arch=x86-linux') spec = spack.spec.Spec('mpileaks arch=x86-linux')