def test_conflicts(self, server): # Tests that conflicts are detected client = self._get_client(server) archive_path = "%s/distribution.tar.gz" % server.full_address # choxie depends on towel-stuff, which depends on bacon. server.xmlrpc.set_distributions( [ {"name": "choxie", "version": "2.0.0.9", "requires_dist": ["towel-stuff (0.1)"], "url": archive_path}, {"name": "towel-stuff", "version": "0.1", "requires_dist": ["bacon (>= 0.2)"], "url": archive_path}, {"name": "bacon", "version": "0.2", "requires_dist": [], "url": archive_path}, ] ) # name, version, deps. already_installed = [("bacon", "0.1", []), ("chicken", "1.1", ["bacon (0.1)"])] output = install.get_infos("choxie", index=client, installed=get_installed_dists(already_installed)) # we need bacon 0.2, but 0.1 is installed. # So we expect to remove 0.1 and to install 0.2 instead. installed, remove, conflict = self._get_results(output) self.assertIn(("choxie", "2.0.0.9"), installed) self.assertIn(("towel-stuff", "0.1"), installed) self.assertIn(("bacon", "0.2"), installed) self.assertIn(("bacon", "0.1"), remove) self.assertIn(("chicken", "1.1"), conflict)
def test_existing_deps(self, server): # Test that the installer get the dependencies from the metadatas # and ask the index for this dependencies. # In this test case, we have choxie that is dependent from towel-stuff # 0.1, which is in-turn dependent on bacon <= 0.2: # choxie -> towel-stuff -> bacon. # Each release metadata is not provided in metadata 1.2. client = self._get_client(server) archive_path = "%s/distribution.tar.gz" % server.full_address server.xmlrpc.set_distributions( [ {"name": "choxie", "version": "2.0.0.9", "requires_dist": ["towel-stuff (0.1)"], "url": archive_path}, {"name": "towel-stuff", "version": "0.1", "requires_dist": ["bacon (<= 0.2)"], "url": archive_path}, {"name": "bacon", "version": "0.1", "requires_dist": [], "url": archive_path}, ] ) installed = get_installed_dists([("bacon", "0.1", [])]) output = install.get_infos("choxie", index=client, installed=installed) # we don't have installed bacon as it's already installed system-wide self.assertEqual(0, len(output["remove"])) self.assertEqual(2, len(output["install"])) readable_output = [(o.name, str(o.version)) for o in output["install"]] self.assertIn(("towel-stuff", "0.1"), readable_output) self.assertIn(("choxie", "2.0.0.9"), readable_output)
def test_upgrade_existing_deps(self, server): # Tests that the existing distributions can be upgraded if needed. client = self._get_client(server) archive_path = '%s/distribution.tar.gz' % server.full_address server.xmlrpc.set_distributions([ {'name':'choxie', 'version': '2.0.0.9', 'requires_dist': ['towel-stuff (0.1)',], 'url': archive_path}, {'name':'towel-stuff', 'version': '0.1', 'requires_dist': ['bacon (>= 0.2)',], 'url': archive_path}, {'name':'bacon', 'version': '0.2', 'requires_dist': [], 'url': archive_path}, ]) output = get_infos("choxie", index=client, installed= get_fake_dists([('bacon', '0.1', []),])) installed = [(o.name, '%s' % o.version) for o in output['install']] # we need bacon 0.2, but 0.1 is installed. # So we expect to remove 0.1 and to install 0.2 instead. remove = [(o.name, '%s' % o.version) for o in output['remove']] self.assertIn(('choxie', '2.0.0.9'), installed) self.assertIn(('towel-stuff', '0.1'), installed) self.assertIn(('bacon', '0.2'), installed) self.assertIn(('bacon', '0.1'), remove) self.assertEqual(0, len(output['conflict']))
def test_existing_deps(self, server): # Test that the installer get the dependencies from the metadatas # and ask the index for this dependencies. # In this test case, we have choxie that is dependent from towel-stuff # 0.1, which is in-turn dependent on bacon <= 0.2: # choxie -> towel-stuff -> bacon. # Each release metadata is not provided in metadata 1.2. client = self._get_client(server) archive_path = '%s/distribution.tar.gz' % server.full_address server.xmlrpc.set_distributions([ {'name':'choxie', 'version': '2.0.0.9', 'requires_dist': ['towel-stuff (0.1)',], 'url': archive_path}, {'name':'towel-stuff', 'version': '0.1', 'requires_dist': ['bacon (<= 0.2)',], 'url': archive_path}, {'name':'bacon', 'version': '0.1', 'requires_dist': [], 'url': archive_path}, ]) installed = get_fake_dists([('bacon', '0.1', []),]) output = get_infos("choxie", index=client, installed=installed) # we dont have installed bacon as it's already installed on the system. self.assertEqual(0, len(output['remove'])) self.assertEqual(2, len(output['install'])) readable_output = [(o.name, '%s' % o.version) for o in output['install']] self.assertIn(('towel-stuff', '0.1'), readable_output) self.assertIn(('choxie', '2.0.0.9'), readable_output)
def test_conflicts(self, server): # Tests that conflicts are detected client = self._get_client(server) archive_path = '%s/distribution.tar.gz' % server.full_address server.xmlrpc.set_distributions([ {'name':'choxie', 'version': '2.0.0.9', 'requires_dist': ['towel-stuff (0.1)',], 'url': archive_path}, {'name':'towel-stuff', 'version': '0.1', 'requires_dist': ['bacon (>= 0.2)',], 'url': archive_path}, {'name':'bacon', 'version': '0.2', 'requires_dist': [], 'url': archive_path}, ]) already_installed = [('bacon', '0.1', []), ('chicken', '1.1', ['bacon (0.1)'])] output = get_infos("choxie", index=client, installed= get_fake_dists(already_installed)) # we need bacon 0.2, but 0.1 is installed. # So we expect to remove 0.1 and to install 0.2 instead. installed, remove, conflict = self._get_results(output) self.assertIn(('choxie', '2.0.0.9'), installed) self.assertIn(('towel-stuff', '0.1'), installed) self.assertIn(('bacon', '0.2'), installed) self.assertIn(('bacon', '0.1'), remove) self.assertIn(('chicken', '1.1'), conflict)
def test_conflicts(self, server): # Tests that conflicts are detected client = self._get_client(server) archive_path = '%s/distribution.tar.gz' % server.full_address # choxie depends on towel-stuff, which depends on bacon. server.xmlrpc.set_distributions([ { 'name': 'choxie', 'version': '2.0.0.9', 'requires_dist': ['towel-stuff (0.1)'], 'url': archive_path }, { 'name': 'towel-stuff', 'version': '0.1', 'requires_dist': ['bacon (>= 0.2)'], 'url': archive_path }, { 'name': 'bacon', 'version': '0.2', 'requires_dist': [], 'url': archive_path }, ]) # name, version, deps. already_installed = [('bacon', '0.1', []), ('chicken', '1.1', ['bacon (0.1)'])] output = install.get_infos( 'choxie', index=client, installed=get_installed_dists(already_installed)) # we need bacon 0.2, but 0.1 is installed. # So we expect to remove 0.1 and to install 0.2 instead. installed, remove, conflict = self._get_results(output) self.assertIn(('choxie', '2.0.0.9'), installed) self.assertIn(('towel-stuff', '0.1'), installed) self.assertIn(('bacon', '0.2'), installed) self.assertIn(('bacon', '0.1'), remove) self.assertIn(('chicken', '1.1'), conflict)
def test_upgrade_existing_deps(self, server): client = self._get_client(server) archive_path = '%s/distribution.tar.gz' % server.full_address server.xmlrpc.set_distributions([ { 'name': 'choxie', 'version': '2.0.0.9', 'requires_dist': ['towel-stuff (0.1)'], 'url': archive_path }, { 'name': 'towel-stuff', 'version': '0.1', 'requires_dist': ['bacon (>= 0.2)'], 'url': archive_path }, { 'name': 'bacon', 'version': '0.2', 'requires_dist': [], 'url': archive_path }, ]) output = install.get_infos("choxie", index=client, installed=get_installed_dists([ ('bacon', '0.1', []) ])) installed = [(o.name, str(o.version)) for o in output['install']] # we need bacon 0.2, but 0.1 is installed. # So we expect to remove 0.1 and to install 0.2 instead. remove = [(o.name, str(o.version)) for o in output['remove']] self.assertIn(('choxie', '2.0.0.9'), installed) self.assertIn(('towel-stuff', '0.1'), installed) self.assertIn(('bacon', '0.2'), installed) self.assertIn(('bacon', '0.1'), remove) self.assertEqual(0, len(output['conflict']))
def test_upgrade_existing_deps(self, server): client = self._get_client(server) archive_path = "%s/distribution.tar.gz" % server.full_address server.xmlrpc.set_distributions( [ {"name": "choxie", "version": "2.0.0.9", "requires_dist": ["towel-stuff (0.1)"], "url": archive_path}, {"name": "towel-stuff", "version": "0.1", "requires_dist": ["bacon (>= 0.2)"], "url": archive_path}, {"name": "bacon", "version": "0.2", "requires_dist": [], "url": archive_path}, ] ) output = install.get_infos("choxie", index=client, installed=get_installed_dists([("bacon", "0.1", [])])) installed = [(o.name, str(o.version)) for o in output["install"]] # we need bacon 0.2, but 0.1 is installed. # So we expect to remove 0.1 and to install 0.2 instead. remove = [(o.name, str(o.version)) for o in output["remove"]] self.assertIn(("choxie", "2.0.0.9"), installed) self.assertIn(("towel-stuff", "0.1"), installed) self.assertIn(("bacon", "0.2"), installed) self.assertIn(("bacon", "0.1"), remove) self.assertEqual(0, len(output["conflict"]))
def test_existing_deps(self, server): # Test that the installer get the dependencies from the metadatas # and ask the index for this dependencies. # In this test case, we have choxie that is dependent from towel-stuff # 0.1, which is in-turn dependent on bacon <= 0.2: # choxie -> towel-stuff -> bacon. # Each release metadata is not provided in metadata 1.2. client = self._get_client(server) archive_path = '%s/distribution.tar.gz' % server.full_address server.xmlrpc.set_distributions([ { 'name': 'choxie', 'version': '2.0.0.9', 'requires_dist': ['towel-stuff (0.1)'], 'url': archive_path }, { 'name': 'towel-stuff', 'version': '0.1', 'requires_dist': ['bacon (<= 0.2)'], 'url': archive_path }, { 'name': 'bacon', 'version': '0.1', 'requires_dist': [], 'url': archive_path }, ]) installed = get_installed_dists([('bacon', '0.1', [])]) output = install.get_infos("choxie", index=client, installed=installed) # we don't have installed bacon as it's already installed system-wide self.assertEqual(0, len(output['remove'])) self.assertEqual(2, len(output['install'])) readable_output = [(o.name, str(o.version)) for o in output['install']] self.assertIn(('towel-stuff', '0.1'), readable_output) self.assertIn(('choxie', '2.0.0.9'), readable_output)