def test_circular_dependencies(): index2 = index.copy() index2['package1-1.0-0.tar.bz2'] = { 'build': '0', 'build_number': 0, 'depends': ['package2'], 'name': 'package1', 'requires': ['package2'], 'version': '1.0', } index2['package2-1.0-0.tar.bz2'] = { 'build': '0', 'build_number': 0, 'depends': ['package1'], 'name': 'package2', 'requires': ['package1'], 'version': '1.0', } r = Resolve(index2) assert set(r.find_matches(MatchSpec('package1'))) == { 'package1-1.0-0.tar.bz2', } assert set(r.get_dists(['package1'])[0].keys()) == { 'package1-1.0-0.tar.bz2', 'package2-1.0-0.tar.bz2', } assert r.install(['package1']) == r.install(['package2']) == \ r.install(['package1', 'package2']) == [ 'package1-1.0-0.tar.bz2', 'package2-1.0-0.tar.bz2', ]
def test_install_package_with_feature(): index2 = index.copy() index2['mypackage-1.0-featurepy33_0.tar.bz2'] = { 'build': 'featurepy33_0', 'build_number': 0, 'depends': ['python 3.3*'], 'name': 'mypackage', 'version': '1.0', 'features': 'feature', } index2['feature-1.0-py33_0.tar.bz2'] = { 'build': 'py33_0', 'build_number': 0, 'depends': ['python 3.3*'], 'name': 'feature', 'version': '1.0', 'track_features': 'feature', } r = Resolve(index2) # It should not raise r.install(['mypackage', 'feature 1.0'])
def test_install_package_with_feature(): index2 = index.copy() index2['mypackage-1.0-featurepy33_0.tar.bz2'] = { 'build': 'featurepy33_0', 'build_number': 0, 'depends': ['python 3.3*'], 'name': 'mypackage', 'version': '1.0', 'features': 'feature', } index2['feature-1.0-py33_0.tar.bz2'] = { 'build': 'py33_0', 'build_number': 0, 'depends': ['python 3.3*'], 'name': 'feature', 'version': '1.0', 'track_features': 'feature', } r = Resolve(index2) # It should not raise r.install(['mypackage','feature 1.0'])
def test_nonexistent_deps(): index2 = index.copy() index2['mypackage-1.0-py33_0.tar.bz2'] = { 'build': 'py33_0', 'build_number': 0, 'depends': ['nose', 'python 3.3*', 'notarealpackage 2.0*'], 'name': 'mypackage', 'requires': ['nose 1.2.1', 'python 3.3'], 'version': '1.0', } index2['mypackage-1.1-py33_0.tar.bz2'] = { 'build': 'py33_0', 'build_number': 0, 'depends': ['nose', 'python 3.3*'], 'name': 'mypackage', 'requires': ['nose 1.2.1', 'python 3.3'], 'version': '1.1', } index2['anotherpackage-1.0-py33_0.tar.bz2'] = { 'build': 'py33_0', 'build_number': 0, 'depends': ['nose', 'mypackage 1.1'], 'name': 'anotherpackage', 'requires': ['nose', 'mypackage 1.1'], 'version': '1.0', } index2['anotherpackage-2.0-py33_0.tar.bz2'] = { 'build': 'py33_0', 'build_number': 0, 'depends': ['nose', 'mypackage'], 'name': 'anotherpackage', 'requires': ['nose', 'mypackage'], 'version': '2.0', } r = Resolve(index2) assert set(r.find_matches(MatchSpec('mypackage'))) == { 'mypackage-1.0-py33_0.tar.bz2', 'mypackage-1.1-py33_0.tar.bz2', } assert set(r.get_dists(['mypackage'])[0].keys()) == { 'mypackage-1.1-py33_0.tar.bz2', 'nose-1.1.2-py33_0.tar.bz2', 'nose-1.2.1-py33_0.tar.bz2', 'nose-1.3.0-py33_0.tar.bz2', 'openssl-1.0.1c-0.tar.bz2', 'python-3.3.0-2.tar.bz2', 'python-3.3.0-3.tar.bz2', 'python-3.3.0-4.tar.bz2', 'python-3.3.0-pro0.tar.bz2', 'python-3.3.0-pro1.tar.bz2', 'python-3.3.1-0.tar.bz2', 'python-3.3.2-0.tar.bz2', 'readline-6.2-0.tar.bz2', 'sqlite-3.7.13-0.tar.bz2', 'system-5.8-0.tar.bz2', 'system-5.8-1.tar.bz2', 'tk-8.5.13-0.tar.bz2', 'zlib-1.2.7-0.tar.bz2' } assert r.install(['mypackage']) == r.install(['mypackage 1.1']) == [ 'mypackage-1.1-py33_0.tar.bz2', 'nose-1.3.0-py33_0.tar.bz2', 'openssl-1.0.1c-0.tar.bz2', 'python-3.3.2-0.tar.bz2', 'readline-6.2-0.tar.bz2', 'sqlite-3.7.13-0.tar.bz2', 'system-5.8-1.tar.bz2', 'tk-8.5.13-0.tar.bz2', 'zlib-1.2.7-0.tar.bz2', ] assert raises(NoPackagesFound, lambda: r.install(['mypackage 1.0'])) assert raises(NoPackagesFound, lambda: r.install(['mypackage 1.0', 'burgertime 1.0'])) assert r.install(['anotherpackage 1.0']) == [ 'anotherpackage-1.0-py33_0.tar.bz2', 'mypackage-1.1-py33_0.tar.bz2', 'nose-1.3.0-py33_0.tar.bz2', 'openssl-1.0.1c-0.tar.bz2', 'python-3.3.2-0.tar.bz2', 'readline-6.2-0.tar.bz2', 'sqlite-3.7.13-0.tar.bz2', 'system-5.8-1.tar.bz2', 'tk-8.5.13-0.tar.bz2', 'zlib-1.2.7-0.tar.bz2', ] assert r.install(['anotherpackage']) == [ 'anotherpackage-2.0-py33_0.tar.bz2', 'mypackage-1.1-py33_0.tar.bz2', 'nose-1.3.0-py33_0.tar.bz2', 'openssl-1.0.1c-0.tar.bz2', 'python-3.3.2-0.tar.bz2', 'readline-6.2-0.tar.bz2', 'sqlite-3.7.13-0.tar.bz2', 'system-5.8-1.tar.bz2', 'tk-8.5.13-0.tar.bz2', 'zlib-1.2.7-0.tar.bz2', ] # This time, the latest version is messed up index3 = index.copy() index3['mypackage-1.1-py33_0.tar.bz2'] = { 'build': 'py33_0', 'build_number': 0, 'depends': ['nose', 'python 3.3*', 'notarealpackage 2.0*'], 'name': 'mypackage', 'requires': ['nose 1.2.1', 'python 3.3'], 'version': '1.1', } index3['mypackage-1.0-py33_0.tar.bz2'] = { 'build': 'py33_0', 'build_number': 0, 'depends': ['nose', 'python 3.3*'], 'name': 'mypackage', 'requires': ['nose 1.2.1', 'python 3.3'], 'version': '1.0', } index3['anotherpackage-1.0-py33_0.tar.bz2'] = { 'build': 'py33_0', 'build_number': 0, 'depends': ['nose', 'mypackage 1.0'], 'name': 'anotherpackage', 'requires': ['nose', 'mypackage 1.0'], 'version': '1.0', } index3['anotherpackage-2.0-py33_0.tar.bz2'] = { 'build': 'py33_0', 'build_number': 0, 'depends': ['nose', 'mypackage'], 'name': 'anotherpackage', 'requires': ['nose', 'mypackage'], 'version': '2.0', } r = Resolve(index3) assert set(r.find_matches(MatchSpec('mypackage'))) == { 'mypackage-1.0-py33_0.tar.bz2', 'mypackage-1.1-py33_0.tar.bz2', } assert set(r.get_dists(['mypackage'])[0].keys()) == { 'mypackage-1.0-py33_0.tar.bz2', 'nose-1.1.2-py33_0.tar.bz2', 'nose-1.2.1-py33_0.tar.bz2', 'nose-1.3.0-py33_0.tar.bz2', 'openssl-1.0.1c-0.tar.bz2', 'python-3.3.0-2.tar.bz2', 'python-3.3.0-3.tar.bz2', 'python-3.3.0-4.tar.bz2', 'python-3.3.0-pro0.tar.bz2', 'python-3.3.0-pro1.tar.bz2', 'python-3.3.1-0.tar.bz2', 'python-3.3.2-0.tar.bz2', 'readline-6.2-0.tar.bz2', 'sqlite-3.7.13-0.tar.bz2', 'system-5.8-0.tar.bz2', 'system-5.8-1.tar.bz2', 'tk-8.5.13-0.tar.bz2', 'zlib-1.2.7-0.tar.bz2' } assert r.install(['mypackage']) == r.install(['mypackage 1.0']) == [ 'mypackage-1.0-py33_0.tar.bz2', 'nose-1.3.0-py33_0.tar.bz2', 'openssl-1.0.1c-0.tar.bz2', 'python-3.3.2-0.tar.bz2', 'readline-6.2-0.tar.bz2', 'sqlite-3.7.13-0.tar.bz2', 'system-5.8-1.tar.bz2', 'tk-8.5.13-0.tar.bz2', 'zlib-1.2.7-0.tar.bz2', ] assert raises(NoPackagesFound, lambda: r.install(['mypackage 1.1'])) assert r.install(['anotherpackage 1.0']) == [ 'anotherpackage-1.0-py33_0.tar.bz2', 'mypackage-1.0-py33_0.tar.bz2', 'nose-1.3.0-py33_0.tar.bz2', 'openssl-1.0.1c-0.tar.bz2', 'python-3.3.2-0.tar.bz2', 'readline-6.2-0.tar.bz2', 'sqlite-3.7.13-0.tar.bz2', 'system-5.8-1.tar.bz2', 'tk-8.5.13-0.tar.bz2', 'zlib-1.2.7-0.tar.bz2', ] # If recursive checking is working correctly, this will give # anotherpackage 2.0, not anotherpackage 1.0 assert r.install(['anotherpackage']) == [ 'anotherpackage-2.0-py33_0.tar.bz2', 'mypackage-1.0-py33_0.tar.bz2', 'nose-1.3.0-py33_0.tar.bz2', 'openssl-1.0.1c-0.tar.bz2', 'python-3.3.2-0.tar.bz2', 'readline-6.2-0.tar.bz2', 'sqlite-3.7.13-0.tar.bz2', 'system-5.8-1.tar.bz2', 'tk-8.5.13-0.tar.bz2', 'zlib-1.2.7-0.tar.bz2', ]
def test_nonexistent_deps(): index2 = index.copy() index2['mypackage-1.0-py33_0.tar.bz2'] = { 'build': 'py33_0', 'build_number': 0, 'depends': ['nose', 'python 3.3*', 'notarealpackage 2.0*'], 'name': 'mypackage', 'requires': ['nose 1.2.1', 'python 3.3'], 'version': '1.0', } index2['mypackage-1.1-py33_0.tar.bz2'] = { 'build': 'py33_0', 'build_number': 0, 'depends': ['nose', 'python 3.3*'], 'name': 'mypackage', 'requires': ['nose 1.2.1', 'python 3.3'], 'version': '1.1', } index2['anotherpackage-1.0-py33_0.tar.bz2'] = { 'build': 'py33_0', 'build_number': 0, 'depends': ['nose', 'mypackage 1.1'], 'name': 'anotherpackage', 'requires': ['nose', 'mypackage 1.1'], 'version': '1.0', } index2['anotherpackage-2.0-py33_0.tar.bz2'] = { 'build': 'py33_0', 'build_number': 0, 'depends': ['nose', 'mypackage'], 'name': 'anotherpackage', 'requires': ['nose', 'mypackage'], 'version': '2.0', } r = Resolve(index2) assert set(r.find_matches(MatchSpec('mypackage'))) == { 'mypackage-1.0-py33_0.tar.bz2', 'mypackage-1.1-py33_0.tar.bz2', } assert set(r.get_dists(['mypackage'])[0].keys()) == { 'mypackage-1.1-py33_0.tar.bz2', 'nose-1.1.2-py33_0.tar.bz2', 'nose-1.2.1-py33_0.tar.bz2', 'nose-1.3.0-py33_0.tar.bz2', 'openssl-1.0.1c-0.tar.bz2', 'python-3.3.0-2.tar.bz2', 'python-3.3.0-3.tar.bz2', 'python-3.3.0-4.tar.bz2', 'python-3.3.0-pro0.tar.bz2', 'python-3.3.0-pro1.tar.bz2', 'python-3.3.1-0.tar.bz2', 'python-3.3.2-0.tar.bz2', 'readline-6.2-0.tar.bz2', 'sqlite-3.7.13-0.tar.bz2', 'system-5.8-0.tar.bz2', 'system-5.8-1.tar.bz2', 'tk-8.5.13-0.tar.bz2', 'zlib-1.2.7-0.tar.bz2'} assert r.install(['mypackage']) == r.install(['mypackage 1.1']) == [ 'mypackage-1.1-py33_0.tar.bz2', 'nose-1.3.0-py33_0.tar.bz2', 'openssl-1.0.1c-0.tar.bz2', 'python-3.3.2-0.tar.bz2', 'readline-6.2-0.tar.bz2', 'sqlite-3.7.13-0.tar.bz2', 'system-5.8-1.tar.bz2', 'tk-8.5.13-0.tar.bz2', 'zlib-1.2.7-0.tar.bz2', ] assert raises(NoPackagesFound, lambda: r.install(['mypackage 1.0'])) assert raises(NoPackagesFound, lambda: r.install(['mypackage 1.0', 'burgertime 1.0'])) assert r.install(['anotherpackage 1.0']) == [ 'anotherpackage-1.0-py33_0.tar.bz2', 'mypackage-1.1-py33_0.tar.bz2', 'nose-1.3.0-py33_0.tar.bz2', 'openssl-1.0.1c-0.tar.bz2', 'python-3.3.2-0.tar.bz2', 'readline-6.2-0.tar.bz2', 'sqlite-3.7.13-0.tar.bz2', 'system-5.8-1.tar.bz2', 'tk-8.5.13-0.tar.bz2', 'zlib-1.2.7-0.tar.bz2', ] assert r.install(['anotherpackage']) == [ 'anotherpackage-2.0-py33_0.tar.bz2', 'mypackage-1.1-py33_0.tar.bz2', 'nose-1.3.0-py33_0.tar.bz2', 'openssl-1.0.1c-0.tar.bz2', 'python-3.3.2-0.tar.bz2', 'readline-6.2-0.tar.bz2', 'sqlite-3.7.13-0.tar.bz2', 'system-5.8-1.tar.bz2', 'tk-8.5.13-0.tar.bz2', 'zlib-1.2.7-0.tar.bz2', ] # This time, the latest version is messed up index3 = index.copy() index3['mypackage-1.1-py33_0.tar.bz2'] = { 'build': 'py33_0', 'build_number': 0, 'depends': ['nose', 'python 3.3*', 'notarealpackage 2.0*'], 'name': 'mypackage', 'requires': ['nose 1.2.1', 'python 3.3'], 'version': '1.1', } index3['mypackage-1.0-py33_0.tar.bz2'] = { 'build': 'py33_0', 'build_number': 0, 'depends': ['nose', 'python 3.3*'], 'name': 'mypackage', 'requires': ['nose 1.2.1', 'python 3.3'], 'version': '1.0', } index3['anotherpackage-1.0-py33_0.tar.bz2'] = { 'build': 'py33_0', 'build_number': 0, 'depends': ['nose', 'mypackage 1.0'], 'name': 'anotherpackage', 'requires': ['nose', 'mypackage 1.0'], 'version': '1.0', } index3['anotherpackage-2.0-py33_0.tar.bz2'] = { 'build': 'py33_0', 'build_number': 0, 'depends': ['nose', 'mypackage'], 'name': 'anotherpackage', 'requires': ['nose', 'mypackage'], 'version': '2.0', } r = Resolve(index3) assert set(r.find_matches(MatchSpec('mypackage'))) == { 'mypackage-1.0-py33_0.tar.bz2', 'mypackage-1.1-py33_0.tar.bz2', } assert set(r.get_dists(['mypackage'])[0].keys()) == { 'mypackage-1.0-py33_0.tar.bz2', 'nose-1.1.2-py33_0.tar.bz2', 'nose-1.2.1-py33_0.tar.bz2', 'nose-1.3.0-py33_0.tar.bz2', 'openssl-1.0.1c-0.tar.bz2', 'python-3.3.0-2.tar.bz2', 'python-3.3.0-3.tar.bz2', 'python-3.3.0-4.tar.bz2', 'python-3.3.0-pro0.tar.bz2', 'python-3.3.0-pro1.tar.bz2', 'python-3.3.1-0.tar.bz2', 'python-3.3.2-0.tar.bz2', 'readline-6.2-0.tar.bz2', 'sqlite-3.7.13-0.tar.bz2', 'system-5.8-0.tar.bz2', 'system-5.8-1.tar.bz2', 'tk-8.5.13-0.tar.bz2', 'zlib-1.2.7-0.tar.bz2'} assert r.install(['mypackage']) == r.install(['mypackage 1.0']) == [ 'mypackage-1.0-py33_0.tar.bz2', 'nose-1.3.0-py33_0.tar.bz2', 'openssl-1.0.1c-0.tar.bz2', 'python-3.3.2-0.tar.bz2', 'readline-6.2-0.tar.bz2', 'sqlite-3.7.13-0.tar.bz2', 'system-5.8-1.tar.bz2', 'tk-8.5.13-0.tar.bz2', 'zlib-1.2.7-0.tar.bz2', ] assert raises(NoPackagesFound, lambda: r.install(['mypackage 1.1'])) assert r.install(['anotherpackage 1.0']) == [ 'anotherpackage-1.0-py33_0.tar.bz2', 'mypackage-1.0-py33_0.tar.bz2', 'nose-1.3.0-py33_0.tar.bz2', 'openssl-1.0.1c-0.tar.bz2', 'python-3.3.2-0.tar.bz2', 'readline-6.2-0.tar.bz2', 'sqlite-3.7.13-0.tar.bz2', 'system-5.8-1.tar.bz2', 'tk-8.5.13-0.tar.bz2', 'zlib-1.2.7-0.tar.bz2', ] # If recursive checking is working correctly, this will give # anotherpackage 2.0, not anotherpackage 1.0 assert r.install(['anotherpackage']) == [ 'anotherpackage-2.0-py33_0.tar.bz2', 'mypackage-1.0-py33_0.tar.bz2', 'nose-1.3.0-py33_0.tar.bz2', 'openssl-1.0.1c-0.tar.bz2', 'python-3.3.2-0.tar.bz2', 'readline-6.2-0.tar.bz2', 'sqlite-3.7.13-0.tar.bz2', 'system-5.8-1.tar.bz2', 'tk-8.5.13-0.tar.bz2', 'zlib-1.2.7-0.tar.bz2', ]