def test_remove_spack_attributes(): tree = ast.parse(many_attributes) spec = Spec("has-many-metadata-attributes") tree = ph.RemoveDirectives(spec).visit(tree) unparsed = unparse(tree, py_ver_consistent=True) assert unparsed == many_attributes_canonical
def test_remove_complex_package_logic_filtered(): tree = ast.parse(complex_package_logic) spec = Spec("has-many-metadata-attributes") tree = ph.RemoveDirectives(spec).visit(tree) unparsed = unparse(tree, py_ver_consistent=True) assert unparsed == complex_package_logic_filtered
def test_remove_all_directives(): """Ensure all directives are removed from packages before hashing.""" for name in spack.directives.directive_names: assert name in many_directives tree = ast.parse(many_directives) spec = Spec("has-many-directives") tree = ph.RemoveDirectives(spec).visit(tree) unparsed = unparse(tree, py_ver_consistent=True) for name in spack.directives.directive_names: assert name not in unparsed