diff options
author | Massimiliano Culpo <massimiliano.culpo@googlemail.com> | 2017-05-08 22:24:37 +0200 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2017-05-08 13:24:37 -0700 |
commit | 3efa9bd29678c884df9f9ff8c97416741f01fde1 (patch) | |
tree | 8493e6127316ffad8a93cf6b7e6e597ca00d846f /lib | |
parent | ff3b5d88e4229516e9655a9a75f818453613e8e4 (diff) | |
download | spack-3efa9bd29678c884df9f9ff8c97416741f01fde1.tar.gz spack-3efa9bd29678c884df9f9ff8c97416741f01fde1.tar.bz2 spack-3efa9bd29678c884df9f9ff8c97416741f01fde1.tar.xz spack-3efa9bd29678c884df9f9ff8c97416741f01fde1.zip |
spec_syntax: added xfailing tests for cases in #4144 (#4151)
It seems that parse_anonymous_spec may fail if more than one part
(variant, version range, etc.) is given to the function. Added tests to
code against to fix the problem in #4144.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/test/spec_syntax.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/spack/spack/test/spec_syntax.py b/lib/spack/spack/test/spec_syntax.py index dfad4a019f..2ee9ef486c 100644 --- a/lib/spack/spack/test/spec_syntax.py +++ b/lib/spack/spack/test/spec_syntax.py @@ -138,6 +138,13 @@ class TestSpecSyntax(object): self.check_parse("^zlib") self.check_parse("+foo") self.check_parse("arch=test-None-None", "platform=test") + self.check_parse('@2.7:') + + @pytest.mark.xfail() + def test_anonymous_specs_with_multiple_parts(self): + # Parse anonymous spec with multiple tokens + self.check_parse('languages=go @4.2:') + self.check_parse('@4.2: languages=go') def test_simple_dependence(self): self.check_parse("openmpi^hwloc") @@ -539,3 +546,22 @@ class TestSpecSyntax(object): "mvapich_foo debug= 4 " "^ _openmpi @1.2 : 1.4 , 1.6 % intel @ 12.1 : 12.6 + debug - qt_4 " "^ stackwalker @ 8.1_1e") + + +@pytest.mark.parametrize('spec,anon_spec,spec_name', [ + ('openmpi languages=go', 'languages=go', 'openmpi'), + ('openmpi @4.6:', '@4.6:', 'openmpi'), + pytest.mark.xfail( + ('openmpi languages=go @4.6:', 'languages=go @4.6:', 'openmpi') + ), + pytest.mark.xfail( + ('openmpi @4.6: languages=go', '@4.6: languages=go', 'openmpi') + ), +]) +def test_parse_anonymous_specs(spec, anon_spec, spec_name): + + expected = parse(spec) + spec = parse_anonymous_spec(anon_spec, spec_name) + + assert len(expected) == 1 + assert spec in expected |