Ejemplo n.º 1
0
    def test_level_one_group_resolution_packages(self):
        ur = TargetResolver(self.config)
        pr = PackageResolver(P('r')/'groups'/'gr1')

        gr1 = ur.resolve('gr1', {})
        assert('gr1' == gr1)
        assert(resolve(pr, ['gr1p1', 'gr1p2']) == gr1._packages)
Ejemplo n.º 2
0
    def test_caches_resolve(self):
        r  = self.MockResolver({'a': ['b'],
                                'b': [],    })
        ns = resolve(r, ['a'])
        assert(['a', 'b'] == ns)
        assert(2 == len(r.resolutions()))
        assert('a' in r.resolutions())
        assert('b' in r.resolutions())

        r  = self.MockResolver({'a': ['b'],
                                'b': [],    })
        ns = resolve(r, ['a', 'b'])
        assert(['a', 'b'] == ns)
        assert(2 == len(r.resolutions()))
        assert('a' in r.resolutions())
        assert('b' in r.resolutions())
Ejemplo n.º 3
0
    def test_caches_resolve(self):
        r  = self.MockResolver({'a': ['b'],
                                'b': [],    })
        ns = resolve(r, ['a'])
        assert(['a', 'b'] == ns)
        assert(2 == len(r.resolutions()))
        assert('a' in r.resolutions())
        assert('b' in r.resolutions())

        r  = self.MockResolver({'a': ['b'],
                                'b': [],    })
        ns = resolve(r, ['a', 'b'])
        assert(['a', 'b'] == ns)
        assert(2 == len(r.resolutions()))
        assert('a' in r.resolutions())
        assert('b' in r.resolutions())
Ejemplo n.º 4
0
    def test_level_one_group_resolution_packages(self):
        ur = TargetResolver(self.config)
        pr = PackageResolver(P('r') / 'groups' / 'gr1')

        gr1 = ur.resolve('gr1', {})
        assert ('gr1' == gr1)
        assert (resolve(pr, ['gr1p1', 'gr1p2']) == gr1._packages)
Ejemplo n.º 5
0
    def test_target_with_dependencies(self):
        f = StringIO()
        run(f, None, None, None, None, ['walk', 'gr2'])

        r = TargetResolver(self._config)
        us = resolve(r, ['gr2'])

        assert (' '.join(u.name for u in us) + '\n' == f.getvalue())
Ejemplo n.º 6
0
    def test_target_with_dependencies(self):
        f = StringIO()
        run(f, None, None, None, None, ['walk', 'gr2'])

        r  = TargetResolver(self._config)
        us = resolve(r, ['gr2'])

        assert(' '.join(u.name for u in us) + '\n' == f.getvalue())
Ejemplo n.º 7
0
    def test_generate_cmake(self):
        output1 = StringIO()

        run(output1, None, output1, None, ['cmake', 'bdemeta.json', 'p'])

        r       = TargetResolver(self._config)
        p       = resolve(r, 'p')
        output2 = StringIO()
        generate(p, output2)

        assert(output1.getvalue() == output2.getvalue())
Ejemplo n.º 8
0
    def test_generate_cmake(self):
        output = StringIO()

        f1 = {}
        w1 = get_filestore_writer(f1)

        run(output, None, w1, None, None, ['cmake', 'p'])

        r = TargetResolver(self._config)
        p = resolve(r, 'p')
        f2 = {}
        w2 = get_filestore_writer(f2)
        generate(p, w2)

        assert (f1.keys() == f2.keys())
        for k in f1:
            assert (f1[k].getvalue() == f2[k].getvalue())
Ejemplo n.º 9
0
    def test_generate_cmake(self):
        output = StringIO()

        f1 = {}
        w1 = get_filestore_writer(f1)

        run(output, None, w1, None, None, ['cmake', 'p'])

        r  = TargetResolver(self._config)
        p  = resolve(r, 'p')
        f2 = {}
        w2 = get_filestore_writer(f2)
        generate(p, w2)

        assert(f1.keys() == f2.keys())
        for k in f1:
            assert(f1[k].getvalue() == f2[k].getvalue())
Ejemplo n.º 10
0
 def test_one_resolution_zero_deps(self):
     r  = self.MockResolver({'a': []})
     ns = resolve(r, ['a'])
     assert(['a'] == ns)
     assert(['a'] == r.resolutions())
Ejemplo n.º 11
0
 def test_no_resolution(self):
     r  = self.MockResolver({})
     ns = resolve(r, [])
     assert([] == ns)
     assert([] == r.resolutions())
Ejemplo n.º 12
0
 def test_one_resolution_zero_deps(self):
     r  = self.MockResolver({'a': []})
     ns = resolve(r, ['a'])
     assert(['a'] == ns)
     assert(['a'] == r.resolutions())
Ejemplo n.º 13
0
 def test_no_resolution(self):
     r  = self.MockResolver({})
     ns = resolve(r, [])
     assert([] == ns)
     assert([] == r.resolutions())