From 719fd6fb432a901a022d1685372f42875f563720 Mon Sep 17 00:00:00 2001 From: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com> Date: Wed, 14 May 2025 01:32:47 -0700 Subject: [PATCH] test_load_json_specfiles: skip virtual reconstruction (#50361) --- lib/spack/spack/test/spec_yaml.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/spack/spack/test/spec_yaml.py b/lib/spack/spack/test/spec_yaml.py index 3652d960673..72983681c06 100644 --- a/lib/spack/spack/test/spec_yaml.py +++ b/lib/spack/spack/test/spec_yaml.py @@ -420,13 +420,15 @@ def test_load_json_specfiles(specfile, expected_hash, reader_cls): openmpi_edges = s2.edges_to_dependencies(name="openmpi") assert len(openmpi_edges) == 1 - # Check that virtuals have been reconstructed - assert "mpi" in openmpi_edges[0].virtuals + # Check that virtuals have been reconstructed for specfiles conforming to + # version 4 on. + if reader_cls.SPEC_VERSION >= spack.spec.SpecfileV4.SPEC_VERSION: + assert "mpi" in openmpi_edges[0].virtuals - # The virtuals attribute must be a tuple, when read from a - # JSON or YAML file, not a list - for edge in s2.traverse_edges(): - assert isinstance(edge.virtuals, tuple), edge + # The virtuals attribute must be a tuple, when read from a + # JSON or YAML file, not a list + for edge in s2.traverse_edges(): + assert isinstance(edge.virtuals, tuple), edge # Ensure we can format {compiler} tokens assert s2.format("{compiler}") != "none"