From 1addcff7240deecb3dca992cd5e45a40d02eb92d Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Thu, 20 Aug 2020 17:08:49 +0200 Subject: Test "is_extension" after a round trip to dict (#18188) closes #3887 closes #3853 --- lib/spack/spack/test/spec_semantics.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib') diff --git a/lib/spack/spack/test/spec_semantics.py b/lib/spack/spack/test/spec_semantics.py index d908ce7d89..e4d111a64f 100644 --- a/lib/spack/spack/test/spec_semantics.py +++ b/lib/spack/spack/test/spec_semantics.py @@ -987,3 +987,19 @@ class TestSpecSematics(object): s = Spec('mpileaks +unknown') with pytest.raises(UnknownVariantError, match=r'package has no such'): s.concretize() + + +@pytest.mark.regression('3887') +@pytest.mark.parametrize('spec_str', [ + 'git', 'hdf5', 'py-flake8' +]) +def test_is_extension_after_round_trip_to_dict(config, spec_str): + # x is constructed directly from string, y from a + # round-trip to dict representation + x = Spec(spec_str) + x.concretize() + y = Spec.from_dict(x.to_dict()) + + # Using 'y' since the round-trip make us lose build dependencies + for d in y.traverse(): + assert x[d.name].package.is_extension == y[d.name].package.is_extension -- cgit v1.2.3-60-g2f50