Package portage :: Package tests :: Package resolver :: Module test_eapi
[hide private]

Source Code for Module portage.tests.resolver.test_eapi

  1  # Copyright 2010 Gentoo Foundation 
  2  # Distributed under the terms of the GNU General Public License v2 
  3   
  4  from portage.tests import TestCase 
  5  from portage.tests.resolver.ResolverPlayground import ResolverPlayground, ResolverPlaygroundTestCase 
  6   
7 -class EAPITestCase(TestCase):
8
9 - def testEAPI(self):
10 11 ebuilds = { 12 #EAPI-1: IUSE-defaults 13 "dev-libs/A-1.0": { "EAPI": 0, "IUSE": "+foo" }, 14 "dev-libs/A-1.1": { "EAPI": 1, "IUSE": "+foo" }, 15 "dev-libs/A-1.2": { "EAPI": 2, "IUSE": "+foo" }, 16 "dev-libs/A-1.3": { "EAPI": 3, "IUSE": "+foo" }, 17 "dev-libs/A-1.4": { "EAPI": "4", "IUSE": "+foo" }, 18 19 #EAPI-1: slot deps 20 "dev-libs/A-2.0": { "EAPI": 0, "DEPEND": "dev-libs/B:0" }, 21 "dev-libs/A-2.1": { "EAPI": 1, "DEPEND": "dev-libs/B:0" }, 22 "dev-libs/A-2.2": { "EAPI": 2, "DEPEND": "dev-libs/B:0" }, 23 "dev-libs/A-2.3": { "EAPI": 3, "DEPEND": "dev-libs/B:0" }, 24 "dev-libs/A-2.4": { "EAPI": "4", "DEPEND": "dev-libs/B:0" }, 25 26 #EAPI-2: use deps 27 "dev-libs/A-3.0": { "EAPI": 0, "DEPEND": "dev-libs/B[foo]" }, 28 "dev-libs/A-3.1": { "EAPI": 1, "DEPEND": "dev-libs/B[foo]" }, 29 "dev-libs/A-3.2": { "EAPI": 2, "DEPEND": "dev-libs/B[foo]" }, 30 "dev-libs/A-3.3": { "EAPI": 3, "DEPEND": "dev-libs/B[foo]" }, 31 "dev-libs/A-3.4": { "EAPI": "4", "DEPEND": "dev-libs/B[foo]" }, 32 33 #EAPI-2: strong blocks 34 "dev-libs/A-4.0": { "EAPI": 0, "DEPEND": "!!dev-libs/B" }, 35 "dev-libs/A-4.1": { "EAPI": 1, "DEPEND": "!!dev-libs/B" }, 36 "dev-libs/A-4.2": { "EAPI": 2, "DEPEND": "!!dev-libs/B" }, 37 "dev-libs/A-4.3": { "EAPI": 3, "DEPEND": "!!dev-libs/B" }, 38 "dev-libs/A-4.4": { "EAPI": "4", "DEPEND": "!!dev-libs/B" }, 39 40 #EAPI-4: slot operator deps 41 #~ "dev-libs/A-5.0": { "EAPI": 0, "DEPEND": "dev-libs/B:*" }, 42 #~ "dev-libs/A-5.1": { "EAPI": 1, "DEPEND": "dev-libs/B:*" }, 43 #~ "dev-libs/A-5.2": { "EAPI": 2, "DEPEND": "dev-libs/B:*" }, 44 #~ "dev-libs/A-5.3": { "EAPI": 3, "DEPEND": "dev-libs/B:*" }, 45 #~ "dev-libs/A-5.4": { "EAPI": "4", "DEPEND": "dev-libs/B:*" }, 46 47 #EAPI-4: use dep defaults 48 "dev-libs/A-6.0": { "EAPI": 0, "DEPEND": "dev-libs/B[bar(+)]" }, 49 "dev-libs/A-6.1": { "EAPI": 1, "DEPEND": "dev-libs/B[bar(+)]" }, 50 "dev-libs/A-6.2": { "EAPI": 2, "DEPEND": "dev-libs/B[bar(+)]" }, 51 "dev-libs/A-6.3": { "EAPI": 3, "DEPEND": "dev-libs/B[bar(+)]" }, 52 "dev-libs/A-6.4": { "EAPI": "4", "DEPEND": "dev-libs/B[bar(+)]" }, 53 54 #EAPI-4: REQUIRED_USE 55 "dev-libs/A-7.0": { "EAPI": 0, "IUSE": "foo bar", "REQUIRED_USE": "|| ( foo bar )" }, 56 "dev-libs/A-7.1": { "EAPI": 1, "IUSE": "foo +bar", "REQUIRED_USE": "|| ( foo bar )" }, 57 "dev-libs/A-7.2": { "EAPI": 2, "IUSE": "foo +bar", "REQUIRED_USE": "|| ( foo bar )" }, 58 "dev-libs/A-7.3": { "EAPI": 3, "IUSE": "foo +bar", "REQUIRED_USE": "|| ( foo bar )" }, 59 "dev-libs/A-7.4": { "EAPI": "4", "IUSE": "foo +bar", "REQUIRED_USE": "|| ( foo bar )" }, 60 61 "dev-libs/B-1": {"EAPI": 1, "IUSE": "+foo"}, 62 } 63 64 test_cases = ( 65 ResolverPlaygroundTestCase(["=dev-libs/A-1.0"], success = False), 66 ResolverPlaygroundTestCase(["=dev-libs/A-1.1"], success = True, mergelist = ["dev-libs/A-1.1"]), 67 ResolverPlaygroundTestCase(["=dev-libs/A-1.2"], success = True, mergelist = ["dev-libs/A-1.2"]), 68 ResolverPlaygroundTestCase(["=dev-libs/A-1.3"], success = True, mergelist = ["dev-libs/A-1.3"]), 69 ResolverPlaygroundTestCase(["=dev-libs/A-1.4"], success = True, mergelist = ["dev-libs/A-1.4"]), 70 71 ResolverPlaygroundTestCase(["=dev-libs/A-2.0"], success = False), 72 ResolverPlaygroundTestCase(["=dev-libs/A-2.1"], success = True, mergelist = ["dev-libs/B-1", "dev-libs/A-2.1"]), 73 ResolverPlaygroundTestCase(["=dev-libs/A-2.2"], success = True, mergelist = ["dev-libs/B-1", "dev-libs/A-2.2"]), 74 ResolverPlaygroundTestCase(["=dev-libs/A-2.3"], success = True, mergelist = ["dev-libs/B-1", "dev-libs/A-2.3"]), 75 ResolverPlaygroundTestCase(["=dev-libs/A-2.4"], success = True, mergelist = ["dev-libs/B-1", "dev-libs/A-2.4"]), 76 77 ResolverPlaygroundTestCase(["=dev-libs/A-3.0"], success = False), 78 ResolverPlaygroundTestCase(["=dev-libs/A-3.1"], success = False), 79 ResolverPlaygroundTestCase(["=dev-libs/A-3.2"], success = True, mergelist = ["dev-libs/B-1", "dev-libs/A-3.2"]), 80 ResolverPlaygroundTestCase(["=dev-libs/A-3.3"], success = True, mergelist = ["dev-libs/B-1", "dev-libs/A-3.3"]), 81 ResolverPlaygroundTestCase(["=dev-libs/A-3.4"], success = True, mergelist = ["dev-libs/B-1", "dev-libs/A-3.4"]), 82 83 ResolverPlaygroundTestCase(["=dev-libs/A-4.0"], success = False), 84 ResolverPlaygroundTestCase(["=dev-libs/A-4.1"], success = False), 85 ResolverPlaygroundTestCase(["=dev-libs/A-4.2"], success = True, mergelist = ["dev-libs/A-4.2"]), 86 ResolverPlaygroundTestCase(["=dev-libs/A-4.3"], success = True, mergelist = ["dev-libs/A-4.3"]), 87 ResolverPlaygroundTestCase(["=dev-libs/A-4.4"], success = True, mergelist = ["dev-libs/A-4.4"]), 88 89 ResolverPlaygroundTestCase(["=dev-libs/A-5.0"], success = False), 90 ResolverPlaygroundTestCase(["=dev-libs/A-5.1"], success = False), 91 ResolverPlaygroundTestCase(["=dev-libs/A-5.2"], success = False), 92 ResolverPlaygroundTestCase(["=dev-libs/A-5.3"], success = False), 93 # not implemented: EAPI-4: slot operator deps 94 #~ ResolverPlaygroundTestCase(["=dev-libs/A-5.4"], success = True, mergelist = ["dev-libs/B-1", "dev-libs/A-5.4"]), 95 96 ResolverPlaygroundTestCase(["=dev-libs/A-6.0"], success = False), 97 ResolverPlaygroundTestCase(["=dev-libs/A-6.1"], success = False), 98 ResolverPlaygroundTestCase(["=dev-libs/A-6.2"], success = False), 99 ResolverPlaygroundTestCase(["=dev-libs/A-6.3"], success = False), 100 ResolverPlaygroundTestCase(["=dev-libs/A-6.4"], success = True, mergelist = ["dev-libs/B-1", "dev-libs/A-6.4"]), 101 102 ResolverPlaygroundTestCase(["=dev-libs/A-7.0"], success = False), 103 ResolverPlaygroundTestCase(["=dev-libs/A-7.1"], success = False), 104 ResolverPlaygroundTestCase(["=dev-libs/A-7.2"], success = False), 105 ResolverPlaygroundTestCase(["=dev-libs/A-7.3"], success = False), 106 ResolverPlaygroundTestCase(["=dev-libs/A-7.4"], success = True, mergelist = ["dev-libs/A-7.4"]), 107 ) 108 109 playground = ResolverPlayground(ebuilds=ebuilds) 110 try: 111 for test_case in test_cases: 112 playground.run_TestCase(test_case) 113 self.assertEqual(test_case.test_success, True, test_case.fail_msg) 114 finally: 115 playground.cleanup()
116