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.
This commit is contained in:
Massimiliano Culpo 2017-05-08 22:24:37 +02:00 committed by Todd Gamblin
parent ff3b5d88e4
commit 3efa9bd296

View file

@ -138,6 +138,13 @@ def test_anonymous_specs(self):
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 @@ def test_kv_with_spaces(self):
"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