コード例 #1
0
ファイル: test_egg_info.py プロジェクト: intiocean/pkglib
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()
コード例 #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
コード例 #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
コード例 #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()
コード例 #5
0
ファイル: test_egg_info.py プロジェクト: intiocean/pkglib
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']
コード例 #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']