def test_plan_link_menuinst(self): menuinst = 'menuinst' ipython = 'ipython' actions = { 'PREFIX': 'aprefix', 'LINK': [ipython, menuinst], } conda_plan = plan.plan_from_actions(actions) expected_plan = [ ('PREFIX', 'aprefix'), ('PRINT', 'Linking packages ...'), ('PROGRESS', '2'), ('LINK', ipython), ('LINK', menuinst), ] if sys.platform == 'win32': # menuinst should be linked first expected_plan = [ ('PREFIX', 'aprefix'), ('LINK', menuinst), ('PRINT', 'Linking packages ...'), ('PROGRESS', '1'), ('LINK', ipython), ] # last_two = expected_plan[-2:] # expected_plan[-2:] = last_two[::-1] self.assertEqual(expected_plan, conda_plan)
def test_plan_link_menuinst(self): menuinst = "menuinst" ipython = "ipython" actions = {"PREFIX": "aprefix", "LINK": [ipython, menuinst]} conda_plan = plan.plan_from_actions(actions) expected_plan = [ ("PREFIX", "aprefix"), ("PRINT", "Linking packages ..."), ("PROGRESS", "2"), ("LINK", ipython), ("LINK", menuinst), ] if sys.platform == "win32": # menuinst should be linked first expected_plan = [ ("PREFIX", "aprefix"), ("LINK", menuinst), ("PRINT", "Linking packages ..."), ("PROGRESS", "1"), ("LINK", ipython), ] # last_two = expected_plan[-2:] # expected_plan[-2:] = last_two[::-1] self.assertEqual(expected_plan, conda_plan)
def test_plan_menuinst_first(): if sys.platform != 'win32': return py_ver = ''.join(str(x) for x in sys.version_info[:2]) menuinst = 'menuinst-1.0.3-py%s_0.tar.bz2' % py_ver ipython = 'ipython-2.1.0-py%s_2.tar.bz2' % py_ver actions = { 'PREFIX': conda.config.default_prefix, 'LINK': [ipython, menuinst], 'UNLINK': [ipython, menuinst] } conda_plan = plan.plan_from_actions(actions) assert conda_plan[2] == 'UNLINK %s' % menuinst assert conda_plan[3] == 'LINK %s' % menuinst actions = { 'PREFIX': conda.config.default_prefix, 'LINK': [ipython, menuinst], 'FETCH': [menuinst], 'UNLINK': [ipython, menuinst] } conda_plan = plan.plan_from_actions(actions) assert conda_plan[2] == 'UNLINK %s' % menuinst assert conda_plan[3] == 'FETCH %s' % menuinst assert conda_plan[4] == 'LINK %s' % menuinst actions = { 'PREFIX': conda.config.default_prefix, 'LINK': [ipython, menuinst], 'FETCH': [menuinst], 'EXTRACT': [menuinst], 'UNLINK': [ipython, menuinst] } conda_plan = plan.plan_from_actions(actions) assert conda_plan[2] == 'UNLINK %s' % menuinst assert conda_plan[3] == 'FETCH %s' % menuinst assert conda_plan[4] == 'EXTRACT %s' % menuinst assert conda_plan[5] == 'LINK %s' % menuinst
def test_plan_link_menuinst(self): menuinst = Dist('menuinst-1.4.2-py27_0') menuinst_record = IndexRecord.from_objects(menuinst) ipython = Dist('ipython-5.1.0-py27_1') ipython_record = IndexRecord.from_objects(ipython) actions = defaultdict(list) actions.update({ 'PREFIX': 'aprefix', 'LINK': [ipython, menuinst], }) conda_plan = plan.plan_from_actions(actions, { menuinst: menuinst_record, ipython: ipython_record, }) expected_plan = [ ('PREFIX', 'aprefix'), ('PRINT', 'Linking packages ...'), # ('PROGRESS', '2'), ('PROGRESSIVEFETCHEXTRACT', ProgressiveFetchExtract(index, (ipython, menuinst))), ('UNLINKLINKTRANSACTION', ((), (ipython), menuinst)), ] if on_win: # menuinst should be linked first expected_plan = [ ('PREFIX', 'aprefix'), ('PRINT', 'Linking packages ...'), # ('PROGRESS', '1'), ('PROGRESSIVEFETCHEXTRACT', ProgressiveFetchExtract(index, (menuinst, ipython))), ('UNLINKLINKTRANSACTION', ((), (menuinst, ipython))), ] # last_two = expected_plan[-2:] # expected_plan[-2:] = last_two[::-1] assert expected_plan[0] == conda_plan[0] assert expected_plan[1] == conda_plan[1]
def test_plan_link_menuinst(self): menuinst = Dist('menuinst-1.4.2-py27_0') menuinst_record = IndexRecord.from_objects(menuinst) ipython = Dist('ipython-5.1.0-py27_1') ipython_record = IndexRecord.from_objects(ipython) actions = { 'PREFIX': 'aprefix', 'LINK': [ipython, menuinst], } conda_plan = plan.plan_from_actions(actions, { menuinst: menuinst_record, ipython: ipython_record, }) expected_plan = [ ('PREFIX', 'aprefix'), ('PRINT', 'Linking packages ...'), # ('PROGRESS', '2'), ('PROGRESSIVEFETCHEXTRACT', ProgressiveFetchExtract(index, (ipython, menuinst))), ('UNLINKLINKTRANSACTION', ((), (ipython), menuinst)), ] if on_win: # menuinst should be linked first expected_plan = [ ('PREFIX', 'aprefix'), ('PRINT', 'Linking packages ...'), # ('PROGRESS', '1'), ('PROGRESSIVEFETCHEXTRACT', ProgressiveFetchExtract(index, (menuinst, ipython))), ('UNLINKLINKTRANSACTION', ((), (menuinst, ipython))), ] # last_two = expected_plan[-2:] # expected_plan[-2:] = last_two[::-1] assert expected_plan[0] == conda_plan[0] assert expected_plan[1] == conda_plan[1] assert expected_plan[2] == conda_plan[2]
def test_plan_menuinst_first(): if sys.platform != 'win32': return py_ver = ''.join(str(x) for x in sys.version_info[:2]) menuinst = 'menuinst-1.0.3-py%s_0.tar.bz2' % py_ver ipython = 'ipython-2.1.0-py%s_2.tar.bz2' % py_ver actions = { 'PREFIX': conda.config.default_prefix, 'LINK': [ipython, menuinst], 'UNLINK': [ipython, menuinst] } conda_plan = plan.plan_from_actions(actions) assert conda_plan[2] == 'UNLINK %s' % menuinst assert conda_plan[3] == 'LINK %s' % menuinst actions = { 'PREFIX': conda.config.default_prefix, 'LINK': [ipython, menuinst], 'FETCH': [menuinst], 'UNLINK': [ipython, menuinst] } conda_plan = plan.plan_from_actions(actions) assert conda_plan[2] == 'UNLINK %s' % menuinst assert conda_plan[3] == 'FETCH %s' % menuinst assert conda_plan[4] == 'LINK %s' % menuinst actions = { 'PREFIX': conda.config.default_prefix, 'LINK': [ipython, menuinst], 'FETCH': [menuinst], 'EXTRACT': [menuinst], 'UNLINK': [ipython, menuinst] } conda_plan = plan.plan_from_actions(actions) assert conda_plan[2] == 'UNLINK %s' % menuinst assert conda_plan[3] == 'FETCH %s' % menuinst assert conda_plan[4] == 'EXTRACT %s' % menuinst assert conda_plan[5] == 'LINK %s' % menuinst if py_ver == '27': # Old menuinst versions weren't packaged for Python 3 menuinst_old = 'menuinst-1.0.0-py27_0.tar.bz2' menuinst_new = 'menuinst-1.0.3-py27_0.tar.bz2' actions = { 'PREFIX': conda.config.default_prefix, 'LINK': [menuinst_new], 'FETCH': [menuinst_new], 'EXTRACT': [menuinst_new], 'UNLINK': [menuinst_old] } conda_plan = plan.plan_from_actions(actions) assert conda_plan[2] == 'UNLINK %s' % menuinst_old assert conda_plan[3] == 'FETCH %s' % menuinst_new assert conda_plan[4] == 'EXTRACT %s' % menuinst_new assert conda_plan[5] == 'LINK %s' % menuinst_new