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()
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
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
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()
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']
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']