1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-07-12 01:53:32 +01:00

enable_disable_list: Added a type to handle instrument/result_processor lists

A custom list type now allows "enabling"/"disabling" items by prepending a `~`.
When merged the new state takes priority over the old state.
This commit is contained in:
Sebastian Goscik
2016-04-07 15:08:01 +01:00
parent 05df7c7d9f
commit 8de1b94d73
2 changed files with 43 additions and 1 deletions
wlauto

@ -21,7 +21,7 @@ from nose.tools import raises, assert_equal, assert_not_equal # pylint: disable
from wlauto.utils.android import check_output
from wlauto.utils.misc import merge_dicts, merge_lists, TimeoutError
from wlauto.utils.types import list_or_integer, list_or_bool, caseless_string, arguments
from wlauto.utils.types import list_or_integer, list_or_bool, caseless_string, arguments, enable_disable_list
class TestCheckOutput(TestCase):
@ -89,3 +89,18 @@ class TestTypes(TestCase):
['--foo', '7', '--bar', 'fizz buzz'])
assert_equal(arguments(['test', 42]), ['test', '42'])
def enable_disable_list_test():
a = enable_disable_list(['qaz', 'qwert', 'asd', '~fgh', '~seb'])
b = enable_disable_list(['qaz', 'xyz', '~asd', 'fgh', '~seb'])
a_into_b = ['qaz', 'xyz', '~seb', 'qwert', 'asd', '~fgh']
assert_equal(a.merge_into(b), a_into_b)
assert_equal(b.merge_with(a), a_into_b)
b_into_a = ['qaz', 'qwert', '~seb', 'xyz', '~asd', 'fgh']
assert_equal(b.merge_into(a), b_into_a)
assert_equal(a.merge_with(b), b_into_a)
assert_equal(a.values(), ['qaz', 'qwert', 'asd'])
assert_equal(b.merge_with(a).values(), ['qaz', 'xyz', 'qwert', 'asd'])