Esempio n. 1
0
def test_pin_requirements_not_installed():
    dist = Distribution({'name': 'acme.foo', 'version':'1.0.0',
                         'install_requires': ['foo', 'bar']})
    cmd = egg_info.egg_info(dist)
    with patch('pkg_resources.working_set', []):
        with pytest.raises(ValueError):
            cmd.pin_requirements()
Esempio n. 2
0
def get_cmd(version='1.0.0'):
    dist = Distribution({'name': 'acme.foo', 'version': version})
    cmd = egg_info.egg_info(dist)
    cmd.write_file = Mock()
    cmd.pin_requirements = Mock()
    cmd._pypi_client = Mock()
    return cmd
Esempio n. 3
0
def get_cmd(version='1.0.0'):
    dist = Distribution({'name': 'acme.foo', 'version': version})
    cmd = egg_info.egg_info(dist)
    cmd.write_file = Mock()
    cmd.pin_requirements = Mock()
    cmd._pypi_client = Mock()
    return cmd
Esempio n. 4
0
def test_pin_requirements_not_installed():
    dist = Distribution({
        'name': 'acme.foo',
        'version': '1.0.0',
        'install_requires': ['foo', 'bar']
    })
    cmd = egg_info.egg_info(dist)
    with patch('pkg_resources.working_set', []):
        with pytest.raises(ValueError):
            cmd.pin_requirements()
Esempio n. 5
0
def test_pin_requirements():
    dist = Distribution({'name': 'acme.foo', 'version':'1.0.0',
                         'install_requires': ['foo', 'bar'],
                         'tests_require': ['baz']})
    cmd = egg_info.egg_info(dist)
    my_working_set = [
       Pkg('foo', [], version='2.2.2'),
       Pkg('bar', [], version='3.3.3'),
       Pkg('baz', [], version='4.4.4'),
    ]

    with patch('pkg_resources.working_set', my_working_set):
        cmd.pin_requirements()
        assert cmd.distribution.install_requires == ['foo==2.2.2', 'bar==3.3.3']
        assert cmd.distribution.tests_require == ['baz==4.4.4']
Esempio n. 6
0
def test_pin_requirements():
    dist = Distribution({
        'name': 'acme.foo',
        'version': '1.0.0',
        'install_requires': ['foo', 'bar'],
        'tests_require': ['baz']
    })
    cmd = egg_info.egg_info(dist)
    my_working_set = [
        Pkg('foo', [], version='2.2.2'),
        Pkg('bar', [], version='3.3.3'),
        Pkg('baz', [], version='4.4.4'),
    ]

    with patch('pkg_resources.working_set', my_working_set):
        cmd.pin_requirements()
        assert cmd.distribution.install_requires == [
            'foo==2.2.2', 'bar==3.3.3'
        ]
        assert cmd.distribution.tests_require == ['baz==4.4.4']