Add unit tests for dependencies being patched by parent
This commit is contained in:
parent
e226523aeb
commit
930b05fab4
@ -693,3 +693,20 @@ def test_conditional_dependencies(self, spec_str, expected, unexpected):
|
||||
for dep in unexpected:
|
||||
msg = '"{0}" is in "{1}" but was unexpected'
|
||||
assert dep not in s, msg.format(dep, spec_str)
|
||||
|
||||
@pytest.mark.parametrize('spec_str,patched_deps', [
|
||||
('patch-several-dependencies', [('libelf', 1), ('fake', 2)]),
|
||||
('patch-several-dependencies@1.0',
|
||||
[('libelf', 1), ('fake', 2), ('libdwarf', 1)]),
|
||||
('patch-several-dependencies@1.0 ^libdwarf@20111030',
|
||||
[('libelf', 1), ('fake', 2), ('libdwarf', 2)]),
|
||||
('patch-several-dependencies ^libelf@0.8.10',
|
||||
[('libelf', 2), ('fake', 2)]),
|
||||
('patch-several-dependencies +foo', [('libelf', 2), ('fake', 2)])
|
||||
])
|
||||
def test_patching_dependencies(self, spec_str, patched_deps):
|
||||
s = Spec(spec_str).concretized()
|
||||
|
||||
for dep, num_patches in patched_deps:
|
||||
assert s[dep].satisfies('patches=*')
|
||||
assert len(s[dep].variants['patches'].value) == num_patches
|
||||
|
@ -14,5 +14,7 @@ class Libelf(Package):
|
||||
version('0.8.12', 'e21f8273d9f5f6d43a59878dc274fec7')
|
||||
version('0.8.10', '9db4d36c283d9790d8fa7df1f4d7b4d9')
|
||||
|
||||
patch('local.patch', when='@0.8.10')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
touch(prefix.libelf)
|
||||
|
@ -15,10 +15,14 @@ class PatchSeveralDependencies(Package):
|
||||
version('2.0', '0123456789abcdef0123456789abcdef')
|
||||
version('1.0', '0123456789abcdef0123456789abcdef')
|
||||
|
||||
variant('foo', default=False,
|
||||
description='Forces a version on libelf')
|
||||
|
||||
# demonstrate all the different ways to patch things
|
||||
|
||||
# single patch file in repo
|
||||
depends_on('libelf', patches='foo.patch')
|
||||
depends_on('libelf@0.8.10', patches='foo.patch', when='+foo')
|
||||
|
||||
# using a list of patches in one depends_on
|
||||
depends_on('libdwarf', patches=[
|
||||
|
Loading…
Reference in New Issue
Block a user