diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2022-11-05 09:00:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-05 09:00:54 +0100 |
commit | c0ed5612ab406bfe0f638cc3e5a14cc99e91921a (patch) | |
tree | e3e2b8379a3160b236a22930976d9eaf83329c1c | |
parent | d79cba1a770d30a21f851dd6dbcfe96079a4ab3e (diff) | |
download | spack-c0ed5612ab406bfe0f638cc3e5a14cc99e91921a.tar.gz spack-c0ed5612ab406bfe0f638cc3e5a14cc99e91921a.tar.bz2 spack-c0ed5612ab406bfe0f638cc3e5a14cc99e91921a.tar.xz spack-c0ed5612ab406bfe0f638cc3e5a14cc99e91921a.zip |
unparser: fix bug in unit test assertion (#33722)
-rw-r--r-- | lib/spack/spack/test/util/unparse/unparse.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/spack/spack/test/util/unparse/unparse.py b/lib/spack/spack/test/util/unparse/unparse.py index 217f67f35d..49009ae98e 100644 --- a/lib/spack/spack/test/util/unparse/unparse.py +++ b/lib/spack/spack/test/util/unparse/unparse.py @@ -178,16 +178,14 @@ async def f(): """ -def assertASTEqual(ast1, ast2): - ast.dump(ast1) == ast.dump(ast2) - - def check_ast_roundtrip(code1, filename="internal", mode="exec"): ast1 = compile(str(code1), filename, mode, ast.PyCF_ONLY_AST) code2 = spack.util.unparse.unparse(ast1) ast2 = compile(code2, filename, mode, ast.PyCF_ONLY_AST) - assertASTEqual(ast1, ast2) + + error_msg = "Failed to roundtrip {} [mode={}]".format(filename, mode) + assert ast.dump(ast1) == ast.dump(ast2), error_msg def test_core_lib_files(): |