def test_convert_dependencies(): package = Package('foo', '1.2.3') result = SdistBuilder.convert_dependencies(package, [ get_dependency('A', '^1.0'), get_dependency('B', '~1.0'), get_dependency('C', '1.2.3'), ]) main = [ 'A (>=1.0.0.0,<2.0.0.0)', 'B (>=1.0.0.0,<1.1.0.0)', 'C (==1.2.3.0)', ] extras = {} assert result == (main, extras) package = Package('foo', '1.2.3') package.extras = {'bar': [get_dependency('A')]} result = SdistBuilder.convert_dependencies(package, [ get_dependency('A', '>=1.2', optional=True), get_dependency('B', '~1.0'), get_dependency('C', '1.2.3'), ]) main = [ 'B (>=1.0.0.0,<1.1.0.0)', 'C (==1.2.3.0)', ] extras = {'bar': ['A (>=1.2.0.0)']} assert result == (main, extras)
def test_convert_dependencies(): result = SdistBuilder.convert_dependencies([ get_dependency('A', '^1.0'), get_dependency('B', '~1.0'), get_dependency('C', '1.2.3'), ]) main = [ 'A (>=1.0.0.0,<2.0.0.0)', 'B (>=1.0.0.0,<1.1.0.0)', 'C (==1.2.3.0)', ] extras = [] assert result == (main, extras) dependency_with_python = get_dependency('A', '^1.0') dependency_with_python.python_versions = '^3.4' result = SdistBuilder.convert_dependencies([ dependency_with_python, get_dependency('B', '~1.0'), get_dependency('C', '1.2.3'), ]) main = [ 'B (>=1.0.0.0,<1.1.0.0)', 'C (==1.2.3.0)', ] extras = [ 'A (>=1.0.0.0,<2.0.0.0); python_version>="3.4.0.0" and python_version<"4.0.0.0"', ] assert result == (main, extras)
def test_convert_dependencies(): package = Package("foo", "1.2.3") result = SdistBuilder.convert_dependencies( package, [ get_dependency("A", "^1.0"), get_dependency("B", "~1.0"), get_dependency("C", "1.2.3"), ], ) main = ["A>=1.0,<2.0", "B>=1.0,<1.1", "C==1.2.3"] extras = {} assert result == (main, extras) package = Package("foo", "1.2.3") package.extras = {"bar": [get_dependency("A")]} result = SdistBuilder.convert_dependencies( package, [ get_dependency("A", ">=1.2", optional=True), get_dependency("B", "~1.0"), get_dependency("C", "1.2.3"), ], ) main = ["B>=1.0,<1.1", "C==1.2.3"] extras = {"bar": ["A>=1.2"]} assert result == (main, extras) c = get_dependency("C", "1.2.3") c.python_versions = "~2.7 || ^3.6" d = get_dependency("D", "3.4.5", optional=True) d.python_versions = "~2.7 || ^3.4" package.extras = {"baz": [get_dependency("D")]} result = SdistBuilder.convert_dependencies( package, [ get_dependency("A", ">=1.2", optional=True), get_dependency("B", "~1.0"), c, d, ], ) main = ["B>=1.0,<1.1"] extra_python = ( ':python_version >= "2.7" and python_version < "2.8" ' 'or python_version >= "3.6" and python_version < "4.0"' ) extra_d_dependency = ( 'baz:python_version >= "2.7" and python_version < "2.8" ' 'or python_version >= "3.4" and python_version < "4.0"' ) extras = {extra_python: ["C==1.2.3"], extra_d_dependency: ["D==3.4.5"]} assert result == (main, extras)
def test_convert_dependencies(): package = Package('foo', '1.2.3') result = SdistBuilder.convert_dependencies(package, [ get_dependency('A', '^1.0'), get_dependency('B', '~1.0'), get_dependency('C', '1.2.3'), ]) main = [ 'A>=1.0.0.0,<2.0.0.0', 'B>=1.0.0.0,<1.1.0.0', 'C==1.2.3.0', ] extras = {} assert result == (main, extras) package = Package('foo', '1.2.3') package.extras = {'bar': [get_dependency('A')]} result = SdistBuilder.convert_dependencies(package, [ get_dependency('A', '>=1.2', optional=True), get_dependency('B', '~1.0'), get_dependency('C', '1.2.3'), ]) main = [ 'B>=1.0.0.0,<1.1.0.0', 'C==1.2.3.0', ] extras = {'bar': ['A>=1.2.0.0']} assert result == (main, extras) c = get_dependency('C', '1.2.3') c.python_versions = '~2.7 || ^3.6' d = get_dependency('D', '3.4.5', optional=True) d.python_versions = '~2.7 || ^3.4' package.extras = {'baz': [get_dependency('D')]} result = SdistBuilder.convert_dependencies(package, [ get_dependency('A', '>=1.2', optional=True), get_dependency('B', '~1.0'), c, d ]) main = [ 'B>=1.0.0.0,<1.1.0.0', ] extra_python = ( ':(python_version >= "2.7.0.0" and python_version < "2.8.0.0") ' 'or (python_version >= "3.6.0.0" and python_version < "4.0.0.0")') extra_d_dependency = ( 'baz:(python_version >= "2.7.0.0" and python_version < "2.8.0.0") ' 'or (python_version >= "3.4.0.0" and python_version < "4.0.0.0")') extras = { extra_python: ['C==1.2.3.0'], extra_d_dependency: ['D==3.4.5.0'], } assert result == (main, extras)