Ejemplo n.º 1
0
    def setUp(self):
        r = JoinedStore([
                DummyStore(join(INDEX_REPO_DIR, name, 'index-7.1.txt'), name)
                for name in ('epd', 'gpl')])
        r.connect()
        c = Resolve(r)

        self.r = r
        self.c = c

        resolve.PY_VER = '2.7'
Ejemplo n.º 2
0
class TestCycle(unittest.TestCase):
    """Avoid an infinite recursion when the dependencies contain a cycle."""

    def setUp(self):
        self.r = JoinedStore([DummyStore(join(this_dir, "index-cycle.txt"))])
        self.r.connect()
        self.c = Resolve(self.r)

    def test_cycle(self):
        resolve.PY_VER = "2.5"
        try:
            eg = eggs_rs(self.c, "cycleParent 2.0-5")
        except Exception, e:
            self.assertIn("Loop", e.message, "unexpected exception message " + repr(e.message))
        else:
Ejemplo n.º 3
0
class TestChain2(unittest.TestCase):

    r = JoinedStore([
        DummyStore(join(this_dir, name, 'index-7.1.txt'), name)
        for name in ('open', 'runner', 'epd')
    ])
    r.connect()
    c = Resolve(r)

    def test_flat_recur1(self):
        d1 = self.c.install_sequence(Req('openepd'), mode='flat')
        d2 = self.c.install_sequence(Req('openepd'), mode='recur')
        self.assertEqual(d1, d2)
        d3 = self.c.install_sequence(Req('foo'), mode='recur')
        self.assertEqual(d2[:-1], d3[:-1])

    def test_flat_recur2(self):
        for rs in 'epd 7.0', 'epd 7.0-1', 'epd 7.0-2':
            d1 = self.c.install_sequence(Req(rs), mode='flat')
            d2 = self.c.install_sequence(Req(rs), mode='recur')
            self.assertEqual(d1, d2)

    def test_multiple_reqs(self):
        lst = self.c.install_sequence(Req('ets'))
        self.assert_('numpy-1.5.1-2.egg' in lst)
        self.assertEqual(
            self.r.get_metadata('numpy-1.5.1-2.egg').get('repo_dispname'),
            'epd')
Ejemplo n.º 4
0
class TestChain0(unittest.TestCase):

    r = JoinedStore([
        DummyStore(join(this_dir, fn))
        for fn in ['index-add.txt', 'index-5.1.txt', 'index-5.0.txt']
    ])
    r.connect()
    c = Resolve(r)

    def test_25(self):
        resolve.PY_VER = '2.5'
        self.assertEqual(eggs_rs(self.c, 'SciPy 0.8.0.dev5698'), [
            'freetype-2.3.7-1.egg', 'libjpeg-7.0-1.egg', 'numpy-1.3.0-1.egg',
            'PIL-1.1.6-4.egg', 'scipy-0.8.0.dev5698-1.egg'
        ])

        self.assertEqual(eggs_rs(self.c, 'SciPy'),
                         ['numpy-1.3.0-1.egg', 'scipy-0.8.0-1.egg'])

        self.assertEqual(eggs_rs(self.c, 'epdcore'), [
            'AppInst-2.0.4-1.egg', 'numpy-1.3.0-1.egg', 'scipy-0.8.0-1.egg',
            'EPDCore-1.2.5-1.egg'
        ])

    def test_26(self):
        resolve.PY_VER = '2.6'

        self.assertEqual(eggs_rs(self.c, 'SciPy'),
                         ['numpy-1.3.0-2.egg', 'scipy-0.8.0-2.egg'])

        self.assertEqual(
            eggs_rs(self.c, 'epdcore'),
            ['numpy-1.3.0-2.egg', 'scipy-0.8.0-2.egg', 'EPDCore-2.0.0-1.egg'])
Ejemplo n.º 5
0
 def setUp(self):
     self.r = JoinedStore([DummyStore(join(this_dir, "index-cycle.txt"))])
     self.r.connect()
     self.c = Resolve(self.r)
Ejemplo n.º 6
0
class TestChain1(unittest.TestCase):

    r = JoinedStore([
        DummyStore(join(this_dir, name, 'index-7.1.txt'), name)
        for name in ('epd', 'gpl')
    ])
    r.connect()
    c = Resolve(r)

    def test_get_repo(self):
        for req_string, repo_name in [
            ('MySQL_python', 'gpl'),
            ('bitarray', 'epd'),
            ('foobar', None),
        ]:
            egg = self.c.get_egg(Req(req_string))
            if egg is not None:
                self.assertEqual(
                    self.r.get_metadata(egg).get('repo_dispname'), repo_name)

    def test_get_dist(self):
        resolve.PY_VER = '2.7'
        for req_string, repo_name, egg in [
            ('MySQL_python', 'gpl', 'MySQL_python-1.2.3-2.egg'),
            ('numpy', 'epd', 'numpy-1.6.0-3.egg'),
            ('swig', 'epd', 'swig-1.3.40-2.egg'),
            ('swig 1.3.36', 'epd', 'swig-1.3.36-3.egg'),
            ('swig 1.3.40-1', 'epd', 'swig-1.3.40-1.egg'),
            ('swig 1.3.40-2', 'epd', 'swig-1.3.40-2.egg'),
            ('foobar', None, None),
        ]:
            self.assertEqual(self.c.get_egg(Req(req_string)), egg)
            if egg is not None:
                self.assertEqual(
                    self.r.get_metadata(egg).get('repo_dispname'), repo_name)

    def test_reqs_dist(self):
        self.assertEqual(
            self.c.reqs_egg('FiPy-2.1-1.egg'),
            set([
                Req('distribute'),
                Req('scipy'),
                Req('numpy'),
                Req('pysparse 1.2.dev203')
            ]))

    def test_root(self):
        self.assertEqual(
            self.c.install_sequence(Req('numpy 1.5.1'), mode='root'),
            ['numpy-1.5.1-2.egg'])

        self.assertEqual(
            self.c.install_sequence(Req('numpy 1.5.1-1'), mode='root'),
            ['numpy-1.5.1-1.egg'])

    def test_order1(self):
        self.assertEqual(self.c.install_sequence(Req('numpy')),
                         ['MKL-10.3-1.egg', 'numpy-1.6.0-3.egg'])

    def test_order2(self):
        self.assertEqual(
            self.c.install_sequence(Req('scipy')),
            ['MKL-10.3-1.egg', 'numpy-1.5.1-2.egg', 'scipy-0.9.0-1.egg'])
Ejemplo n.º 7
0
 def setUp(self):
     self.r = JoinedStore([
             DummyStore(join(INDEX_REPO_DIR, 'index-cycle.txt'))])
     self.r.connect()
     self.c = Resolve(self.r)