diff options
author | Michał Górny <mgorny@gentoo.org> | 2011-08-06 15:29:12 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2011-08-06 15:29:12 +0200 |
commit | db1e06b0ed0f80ca16be6b5c226a4c3edc33786b (patch) | |
tree | 3b0c52724ea668029bc84a809e07ec95be25b9ec /pmstestsuite | |
parent | Mark not reached assertions as 'unknown'. (diff) | |
download | pms-test-suite-db1e06b0ed0f80ca16be6b5c226a4c3edc33786b.tar.gz pms-test-suite-db1e06b0ed0f80ca16be6b5c226a4c3edc33786b.tar.bz2 pms-test-suite-db1e06b0ed0f80ca16be6b5c226a4c3edc33786b.zip |
Introduce the concept of EAPI groups rather than relevant+supported.
Now we group EAPIs by common behavior, so that test runner could simply
choose a single random EAPI from each group.
Diffstat (limited to 'pmstestsuite')
-rw-r--r-- | pmstestsuite/library/case.py | 47 | ||||
-rw-r--r-- | pmstestsuite/library/standard/banned_commands.py | 2 | ||||
-rw-r--r-- | pmstestsuite/library/standard/deprecated_vars.py | 4 | ||||
-rw-r--r-- | pmstestsuite/library/standard/doins_fail.py | 2 | ||||
-rw-r--r-- | pmstestsuite/library/standard/eclass_metadata.py | 2 | ||||
-rw-r--r-- | pmstestsuite/library/standard/phase_function_order.py | 2 | ||||
-rw-r--r-- | pmstestsuite/library/standard/special_vars.py | 4 | ||||
-rw-r--r-- | pmstestsuite/library/standard/workdir_fallback.py | 2 | ||||
-rw-r--r-- | pmstestsuite/library/test/random_test.py | 2 |
9 files changed, 32 insertions, 35 deletions
diff --git a/pmstestsuite/library/case.py b/pmstestsuite/library/case.py index d05815c..f8f4ce3 100644 --- a/pmstestsuite/library/case.py +++ b/pmstestsuite/library/case.py @@ -2,7 +2,7 @@ # (c) 2011 Michał Górny <mgorny@gentoo.org> # Released under the terms of the 2-clause BSD license. -import copy, random, re +import copy, itertools, random, re from gentoopm.util import ABCObject, BoolCompat from abc import ABCMeta, abstractmethod, abstractproperty @@ -16,6 +16,10 @@ phase_func_names = [ """ Names of all phase functions supported in EAPIs. """ +known_eapis = (0, 1, 2, 3, 4) + +""" All known EAPIs. """ + ebuild_header = '''# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ @@ -345,45 +349,38 @@ class EbuildTestCase(TestCase): @property def supported_eapis(cls): """ - A list of EAPIs for which the test is able to run and gives - predictible results. Defaults to all available EAPIs. - - For example, if a feature is required in EAPI 3+ and optional - in earlier EAPIs, this variable should contain (3,4). - - @type: iterable - """ - return (0, 1, 2, 3, 4) - - @property - def relevant_eapis(cls): - """ - A list of EAPIs for which the test should be run by default (in - non-thorough mode). This should list all the EAPIs where - a change of behaviour occurs. + A list of EAPI groups for which the test can be run and gives + predictible results. The EAPIs are supposed to be grouped by consistent + behavior. Defaults to a single group with all available EAPIs. - When unset, defaults to a random element of .supported_eapis(). + For example, a value of C{((1, 2), (3, 4))} would mean the test is + available since EAPI 1, and it gives same results for EAPI 1 & 2, + and for EAPI 3 & 4. - @type: iterable + @type: iterable(iterable(string)) """ - return (random.choice(cls._eval_prop(cls.supported_eapis)),) + return (known_eapis,) @classmethod def inst_all(cls, thorough = False): """ - Instantiate the test case for all relevant EAPIs. If in thorough - mode, assume all supported EAPIs are relevant. + Instantiate the test case, choosing a single EAPI from each EAPI group + listed in L{supported_eapis}. If thorough mode is enabled, all EAPIs + from each group will be used instead. + @param thorough: whether to use the thorough mode + @type thorough: bool @return: an iterable over test case instances @rtype: generator(L{EbuildTestCase}) """ + supported_eapis = cls._eval_prop(cls.supported_eapis) if thorough: - eapis = cls.supported_eapis + eapis = itertools.chain.from_iterable(supported_eapis) else: - eapis = cls.relevant_eapis + eapis = [random.choice(x) for x in supported_eapis] - for eapi in cls._eval_prop(eapis): + for eapi in eapis: yield cls(eapi = eapi) @property diff --git a/pmstestsuite/library/standard/banned_commands.py b/pmstestsuite/library/standard/banned_commands.py index b2a68b1..914b691 100644 --- a/pmstestsuite/library/standard/banned_commands.py +++ b/pmstestsuite/library/standard/banned_commands.py @@ -5,7 +5,7 @@ from pmstestsuite.library.standard.dbus_case import DBusEbuildTestCase class BannedCommandTest(DBusEbuildTestCase): - relevant_eapis = (3, 4) + supported_eapis = (range(0, 4), (4,)) def __init__(self, *args, **kwargs): DBusEbuildTestCase.__init__(self, *args, **kwargs) diff --git a/pmstestsuite/library/standard/deprecated_vars.py b/pmstestsuite/library/standard/deprecated_vars.py index 25fd487..03286f5 100644 --- a/pmstestsuite/library/standard/deprecated_vars.py +++ b/pmstestsuite/library/standard/deprecated_vars.py @@ -10,7 +10,7 @@ from pmstestsuite.library.standard.ext_cases import DBusFetchingEbuildTestCase class AATest(DBusFetchingEbuildTestCase): """ Test whether AA is declared. """ - relevant_eapis = (3, 4) + supported_eapis = (range(0, 4), (4,)) ebuild_vars = { 'IUSE': 'pms_tests_magical_hidden_use' # XXX? } @@ -38,7 +38,7 @@ class AATest(DBusFetchingEbuildTestCase): class KVTest(DBusEbuildTestCase): """ Test whether KV is declared. """ - relevant_eapis = (3, 4) + supported_eapis = (range(0, 4), (4,)) phase_funcs = { 'src_compile': [ 'pms-test-dbus_append_result "${KV}"' diff --git a/pmstestsuite/library/standard/doins_fail.py b/pmstestsuite/library/standard/doins_fail.py index 06f9335..a45a8e1 100644 --- a/pmstestsuite/library/standard/doins_fail.py +++ b/pmstestsuite/library/standard/doins_fail.py @@ -7,7 +7,7 @@ from pmstestsuite.library.standard.dbus_case import DBusEbuildTestCase class DoInsFailureTest(DBusEbuildTestCase): """ doins() failure handling test. """ - relevant_eapis = (0, 4) + supported_eapis = (range(0, 4), (4,)) phase_funcs = { 'src_install': [ diff --git a/pmstestsuite/library/standard/eclass_metadata.py b/pmstestsuite/library/standard/eclass_metadata.py index a2469f1..225e1d3 100644 --- a/pmstestsuite/library/standard/eclass_metadata.py +++ b/pmstestsuite/library/standard/eclass_metadata.py @@ -52,7 +52,7 @@ class IUseInheritanceTest(VariableInheritanceTest): class EclassDefinedPhasesTest(DBusEclassTestCase): """ Check whether eclasses set DEFINED_PHASES as well. """ - supported_eapis = (4,) + supported_eapis = ((4,),) phase_funcs = { 'pkg_setup': [ ':' diff --git a/pmstestsuite/library/standard/phase_function_order.py b/pmstestsuite/library/standard/phase_function_order.py index 9fe085c..21d8e23 100644 --- a/pmstestsuite/library/standard/phase_function_order.py +++ b/pmstestsuite/library/standard/phase_function_order.py @@ -7,7 +7,7 @@ from pmstestsuite.library.standard.dbus_case import DBusEbuildTestCase class PhaseFunctionOrderTest(DBusEbuildTestCase): """ Phase function execution order test. """ - relevant_eapis = (0, 2, 4) + supported_eapis = ((0, 1), (2, 3), (4,)) def __init__(self, *args, **kwargs): DBusEbuildTestCase.__init__(self, *args, **kwargs) diff --git a/pmstestsuite/library/standard/special_vars.py b/pmstestsuite/library/standard/special_vars.py index 845d698..6ef9c2c 100644 --- a/pmstestsuite/library/standard/special_vars.py +++ b/pmstestsuite/library/standard/special_vars.py @@ -22,7 +22,7 @@ class InheritedVariableTest(DBusEbuildTestCase): class RDependFallbackTest(DBusEbuildTestCase): """ Test whether RDEPEND=${DEPEND} fallback works as expected. """ - relevant_eapis = (3, 4) + supported_eapis = (range(0, 4), (4,)) ebuild_vars = { # that one shall be pretty portable 'DEPEND': 'virtual/libc' @@ -54,7 +54,7 @@ class RDependFallbackTest(DBusEbuildTestCase): class DefinedPhasesTest(DBusEbuildTestCase): """ Test whether DEFINED_PHASES are declared in EAPI 4. """ - supported_eapis = (4,) + supported_eapis = ((4,),) phase_funcs = { 'pkg_setup': [ ':' diff --git a/pmstestsuite/library/standard/workdir_fallback.py b/pmstestsuite/library/standard/workdir_fallback.py index d1fdd18..25085db 100644 --- a/pmstestsuite/library/standard/workdir_fallback.py +++ b/pmstestsuite/library/standard/workdir_fallback.py @@ -7,7 +7,7 @@ from pmstestsuite.library.standard.ext_cases import DBusFetchingEbuildTestCase class WorkdirFallbackTest(DBusFetchingEbuildTestCase): """ S=${WORKDIR} fallback test. """ - relevant_eapis = (3, 4) + supported_eapis = (range(0, 4), (4,)) # In order to disallow S=${WORKDIR} fallback, we need to: # 1) have something in ${A} (i.e. fetch something), diff --git a/pmstestsuite/library/test/random_test.py b/pmstestsuite/library/test/random_test.py index c66341f..2ca5183 100644 --- a/pmstestsuite/library/test/random_test.py +++ b/pmstestsuite/library/test/random_test.py @@ -7,7 +7,7 @@ from pmstestsuite.library.case import EbuildTestCase class RandomExampleTest(EbuildTestCase): """ An absolutely random test. """ - relevant_eapis = (0, 1, 2, 4) + supported_eapis = ((0, 1), (2, 4)) expect_failure = True phase_funcs = { |