예제 #1
0
    def test_root(self):
        self.assertEqual(
            self.c.install_sequence(Req('numpy 1.5.1'), mode='root'),
            [self.repos['epd'] + 'numpy-1.5.1-2.egg'])

        self.assertEqual(
            self.c.install_sequence(Req('numpy 1.5.1-1'), mode='root'),
            [self.repos['epd'] + 'numpy-1.5.1-1.egg'])
예제 #2
0
    def test_misc_methods(self):
        for req_string in ['', 'foo', 'bar 1.2', 'baz 2.6.7-5']:
            r = Req(req_string)
            self.assertEqual(str(r), req_string)
            self.assertEqual(r, r)
            self.assertEqual(eval(repr(r)), r)

        self.assertNotEqual(Req('foo'), Req('bar'))
        self.assertNotEqual(Req('foo 1.4'), Req('foo 1.4-5'))
예제 #3
0
 def test_reqs_dist(self):
     dist = self.repos['epd'] + 'FiPy-2.1-1.egg'
     self.assertEqual(
         self.c.reqs_dist(dist),
         set([
             Req('distribute'),
             Req('scipy'),
             Req('numpy'),
             Req('pysparse 1.2.dev203')
         ]))
예제 #4
0
 def test_get_repo(self):
     for req_string, repo_name in [
         ('MySQL_python', 'gpl'),
         ('bitarray', 'epd'),
         ('foobar', None),
     ]:
         self.assertEqual(self.c.get_repo(Req(req_string)),
                          self.repos[repo_name])
예제 #5
0
 def test_dist_as_req(self):
     for req_string, s in [
         ('numpy', 1),
         ('numpy 1.3.0', 2),
         ('numpy 1.3.0-2', 3),
     ]:
         req = dist_as_req('file:///numpy-1.3.0-2.egg', s)
         self.assertEqual(req, Req(req_string))
         self.assertEqual(req.strictness, s)
예제 #6
0
    def test_add_Reqs_to_spec(self):
        spec = dict(name='dummy', packages=[])
        add_Reqs_to_spec(spec)
        self.assertEqual(spec['Reqs'], set())

        spec = dict(name='dumy', packages=['numpy 1.3.0'])
        add_Reqs_to_spec(spec)
        Reqs = spec['Reqs']
        self.assertEqual(len(Reqs), 1)
        self.assertEqual(Reqs, set([Req('numpy 1.3.0')]))
예제 #7
0
 def test_get_dist(self):
     for req_string, dist in [
         ('MySQL_python', self.repos['gpl'] + 'MySQL_python-1.2.3-2.egg'),
         ('numpy', self.repos['epd'] + 'numpy-1.6.0-3.egg'),
         ('swig', self.repos['epd'] + 'swig-1.3.40-2.egg'),
         ('swig 1.3.36', self.repos['epd'] + 'swig-1.3.36-3.egg'),
         ('swig 1.3.40-1', self.repos['epd'] + 'swig-1.3.40-1.egg'),
         ('swig 1.3.40-2', self.repos['epd'] + 'swig-1.3.40-2.egg'),
         ('foobar', None),
     ]:
         self.assertEqual(self.c.get_dist(Req(req_string)), dist)
예제 #8
0
 def test_init(self):
     for req_string, name, version, build, strictness in [
         ('', None, None, None, 0),
         (' \t', None, None, None, 0),
         ('foo', 'foo', None, None, 1),
         ('bar 1.9', 'bar', '1.9', None, 2),
         ('baz 1.8-2', 'baz', '1.8', 2, 3),
     ]:
         r = Req(req_string)
         self.assertEqual(r.name, name)
         self.assertEqual(r.version, version)
         self.assertEqual(r.build, build)
         self.assertEqual(r.strictness, strictness)
예제 #9
0
    def test_matches_py(self):
        spec = dict(metadata_version='1.1',
                    cname='foo',
                    version='2.4.1',
                    build=3,
                    python=None)
        for py in ['2.4', '2.5', '2.6', '3.1']:
            requirement.PY_VER = py
            self.assertEqual(Req('foo').matches(spec), True)

        spec25 = dict(spec)
        spec25.update(dict(python='2.5'))

        spec26 = dict(spec)
        spec26.update(dict(python='2.6'))

        requirement.PY_VER = '2.5'
        self.assertEqual(Req('foo').matches(spec25), True)
        self.assertEqual(Req('foo').matches(spec26), False)

        requirement.PY_VER = '2.6'
        self.assertEqual(Req('foo').matches(spec25), False)
        self.assertEqual(Req('foo').matches(spec26), True)
예제 #10
0
 def test_matches(self):
     spec = dict(metadata_version='1.1',
                 cname='foo_bar',
                 version='2.4.1',
                 build=3,
                 python=None)
     for req_string, m in [
         ('', True),
         ('foo', False),
         ('Foo-BAR', True),
         ('foo-Bar 2.4.1', True),
         ('FOO-Bar 1.8.7', False),
         ('FOO-BAR 2.4.1-3', True),
         ('FOO-Bar 2.4.1-1', False),
     ]:
         self.assertEqual(Req(req_string).matches(spec), m, req_string)
예제 #11
0
 def test_multiple_reqs(self):
     lst = self.c.install_sequence(Req('ets'))
     self.assert_(self.repos['epd'] + 'numpy-1.5.1-2.egg' in lst)
예제 #12
0
 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)
예제 #13
0
 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])
예제 #14
0
 def test_order2(self):
     self.assertEqual(self.c.install_sequence(Req('scipy')), [
         self.repos['epd'] + egg for egg in 'MKL-10.3-1.egg',
         'numpy-1.5.1-2.egg', 'scipy-0.9.0-1.egg'
     ])
예제 #15
0
 def test_order1(self):
     self.assertEqual(self.c.install_sequence(Req('numpy')), [
         self.repos['epd'] + egg
         for egg in 'MKL-10.3-1.egg', 'numpy-1.6.0-3.egg'
     ])
예제 #16
0
def eggs_rs(c, req_string):
    return [
        dist_naming.filename_dist(d)
        for d in c.install_sequence(Req(req_string))
    ]