Пример #1
0
def test_as_name_version_tuple(from_line):
    ireq = from_line('foo==1.1')
    name, version = as_name_version_tuple(ireq)
    assert name == 'foo'
    assert version == '1.1'

    # Non-pinned versions aren't accepted
    should_be_rejected = [
        'foo==1.*',
        'foo~=1.1,<1.5,>1.2',
        'foo',
    ]
    for spec in should_be_rejected:
        ireq = from_line(spec)
        with raises(TypeError):
            as_name_version_tuple(ireq)
Пример #2
0
def test_as_name_version_tuple(from_line):
    ireq = from_line('foo==1.1')
    name, version = as_name_version_tuple(ireq)
    assert name == 'foo'
    assert version == '1.1'

    # Non-pinned versions aren't accepted
    should_be_rejected = [
        'foo==1.*',
        'foo~=1.1,<1.5,>1.2',
        'foo',
    ]
    for spec in should_be_rejected:
        ireq = from_line(spec)
        with raises(TypeError):
            as_name_version_tuple(ireq)
Пример #3
0
    def get_dependencies(self, ireq):
        if ireq.editable:
            return self.editables[str(ireq.link)]

        name, version = as_name_version_tuple(ireq)
        dependencies = self.index[name][version]
        return [InstallRequirement.from_line(dep) for dep in dependencies]