forked from spack/spack
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding built_types tests, and function class_to_mod
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
- Loading branch information
Showing
5 changed files
with
55 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other | ||
# Spack Project Developers. See the top-level COPYRIGHT file for details. | ||
# | ||
# SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||
|
||
import inspect | ||
|
||
import spack.build_types | ||
from spack.util.naming import class_to_mod | ||
|
||
|
||
def test_class_to_mod(): | ||
""" | ||
Ensure that every module in build_types has a key via class_to_mod. | ||
""" | ||
classes = inspect.getmembers(spack.build_types, inspect.isclass) | ||
for classname, _ in classes: | ||
|
||
# This is more of an abstract class | ||
if classname == "BuildTypeBase": | ||
continue | ||
|
||
build_type = class_to_mod(classname) | ||
assert build_type in spack.build_types.build_types | ||
|
||
|
||
def test_build_type_flags(): | ||
""" | ||
Every build type is required to have a known set of flag attributes. | ||
""" | ||
for build_type in spack.build_types.build_types.values(): | ||
assert hasattr(build_type, "compiler_attrs") | ||
assert hasattr(build_type, "cuda_attrs") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
import inspect | ||
|
||
__all__ = [ | ||
'list_classes' | ||
'list_classes', | ||
] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters