示例#1
0
    def test_splice_with_cached_hashes(self, transitive):
        spec = Spec('splice-t')
        dep = Spec('splice-h+foo')
        spec.concretize()
        dep.concretize()

        # monkeypatch hashes so we can test that they are cached
        spec._full_hash = 'aaaaaa'
        spec._build_hash = 'aaaaaa'
        dep._full_hash = 'bbbbbb'
        dep._build_hash = 'bbbbbb'
        spec['splice-h']._full_hash = 'cccccc'
        spec['splice-h']._build_hash = 'cccccc'
        spec['splice-z']._full_hash = 'dddddd'
        spec['splice-z']._build_hash = 'dddddd'
        dep['splice-z']._full_hash = 'eeeeee'
        dep['splice-z']._build_hash = 'eeeeee'

        out = spec.splice(dep, transitive=transitive)
        out_z_expected = (dep if transitive else spec)['splice-z']

        assert out.full_hash() != spec.full_hash()
        assert (out['splice-h'].full_hash() == dep.full_hash()) == transitive
        assert out['splice-z'].full_hash() == out_z_expected.full_hash()

        assert out.build_hash() != spec.build_hash()
        assert (out['splice-h'].build_hash() == dep.build_hash()) == transitive
        assert out['splice-z'].build_hash() == out_z_expected.build_hash()