summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2021-08-09 00:28:53 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2021-11-05 00:15:47 -0700
commitcfb60ab9e146e650cc5936a558bec56883a7364d (patch)
tree914f7ef08e219a6b594197f67a0a50424d1f5431
parent9eb94be6dd3d790ff9c4238f6a328f0e03bb8f87 (diff)
downloadspack-cfb60ab9e146e650cc5936a558bec56883a7364d.tar.gz
spack-cfb60ab9e146e650cc5936a558bec56883a7364d.tar.bz2
spack-cfb60ab9e146e650cc5936a558bec56883a7364d.tar.xz
spack-cfb60ab9e146e650cc5936a558bec56883a7364d.zip
tests: make `spack diff` test more lenient
The constraints in the `spack diff` test were very specific and assumed a lot about the structure of what was being diffed. Relax them a bit to make them more resilient to changes.
-rw-r--r--lib/spack/spack/test/cmd/diff.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/spack/spack/test/cmd/diff.py b/lib/spack/spack/test/cmd/diff.py
index 9049b3f11b..949e046b56 100644
--- a/lib/spack/spack/test/cmd/diff.py
+++ b/lib/spack/spack/test/cmd/diff.py
@@ -29,10 +29,18 @@ def test_diff_cmd(install_mockery, mock_fetch, mock_archive, mock_packages):
# Calculate the comparison (c)
c = spack.cmd.diff.compare_specs(specA, specB, to_string=True)
- assert len(c['a_not_b']) == 1
- assert len(c['b_not_a']) == 1
- assert c['a_not_b'][0] == ['variant_value', 'mpileaks debug False']
- assert c['b_not_a'][0] == ['variant_value', 'mpileaks debug True']
+
+ # these particular diffs should have the same length b/c thre aren't
+ # any node differences -- just value differences.
+ assert len(c['a_not_b']) == len(c['b_not_a'])
+
+ # ensure that variant diffs are in here the result
+ assert ['variant_value', 'mpileaks debug False'] in c['a_not_b']
+ assert ['variant_value', 'mpileaks debug True'] in c['b_not_a']
+
+ # ensure that hash diffs are in here the result
+ assert ['hash', 'mpileaks %s' % specA.dag_hash()] in c['a_not_b']
+ assert ['hash', 'mpileaks %s' % specB.dag_hash()] in c['b_not_a']
def test_load_first(install_mockery, mock_fetch, mock_archive, mock_packages):