aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/tests
diff options
context:
space:
mode:
authorJoshua Lock <joshua.g.lock@intel.com>2016-11-25 15:28:08 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-11-30 15:47:45 +0000
commit3b45c479de8640f92dd1d9f147b02e1eecfaadc8 (patch)
treeba0d71bdd8028442fd06002dc09e66ddf8291f6d /lib/bb/tests
parent3cb0d1c78b4c2e4f251a59b86c8da583828ad08b (diff)
downloadbitbake-3b45c479de8640f92dd1d9f147b02e1eecfaadc8.tar.gz
bitbake-3b45c479de8640f92dd1d9f147b02e1eecfaadc8.tar.bz2
bitbake-3b45c479de8640f92dd1d9f147b02e1eecfaadc8.zip
bitbake: remove True option to getVar calls
getVar() now defaults to expanding by default, thus remove the True option from getVar() calls with a regex search and replace. Search made with the following regex: getVar ?\(( ?[^,()]*), True\) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/tests')
-rw-r--r--lib/bb/tests/codeparser.py12
-rw-r--r--lib/bb/tests/data.py58
-rw-r--r--lib/bb/tests/parse.py26
3 files changed, 48 insertions, 48 deletions
diff --git a/lib/bb/tests/codeparser.py b/lib/bb/tests/codeparser.py
index b80c315d..a681841d 100644
--- a/lib/bb/tests/codeparser.py
+++ b/lib/bb/tests/codeparser.py
@@ -68,7 +68,7 @@ class VariableReferenceTest(ReferenceTest):
def test_python_reference(self):
self.setEmptyVars(["BAR"])
- self.parseExpression("${@d.getVar('BAR', True) + 'foo'}")
+ self.parseExpression("${@d.getVar('BAR') + 'foo'}")
self.assertReferences(set(["BAR"]))
class ShellReferenceTest(ReferenceTest):
@@ -209,17 +209,17 @@ be. These unit tests are testing snippets."""
return " " + value
def test_getvar_reference(self):
- self.parseExpression("d.getVar('foo', True)")
+ self.parseExpression("d.getVar('foo')")
self.assertReferences(set(["foo"]))
self.assertExecs(set())
def test_getvar_computed_reference(self):
- self.parseExpression("d.getVar('f' + 'o' + 'o', True)")
+ self.parseExpression("d.getVar('f' + 'o' + 'o')")
self.assertReferences(set())
self.assertExecs(set())
def test_getvar_exec_reference(self):
- self.parseExpression("eval('d.getVar(\"foo\", True)')")
+ self.parseExpression("eval('d.getVar(\"foo\")')")
self.assertReferences(set())
self.assertExecs(set(["eval"]))
@@ -269,11 +269,11 @@ be. These unit tests are testing snippets."""
class DependencyReferenceTest(ReferenceTest):
pydata = """
-d.getVar('somevar', True)
+d.getVar('somevar')
def test(d):
foo = 'bar %s' % 'foo'
def test2(d):
- d.getVar(foo, True)
+ d.getVar(foo)
d.getVar('bar', False)
test2(d)
diff --git a/lib/bb/tests/data.py b/lib/bb/tests/data.py
index b54eb067..1a5a28af 100644
--- a/lib/bb/tests/data.py
+++ b/lib/bb/tests/data.py
@@ -77,13 +77,13 @@ class DataExpansions(unittest.TestCase):
self.assertEqual(str(val), "boo value_of_foo")
def test_python_snippet_getvar(self):
- val = self.d.expand("${@d.getVar('foo', True) + ' ${bar}'}")
+ val = self.d.expand("${@d.getVar('foo') + ' ${bar}'}")
self.assertEqual(str(val), "value_of_foo value_of_bar")
def test_python_unexpanded(self):
self.d.setVar("bar", "${unsetvar}")
- val = self.d.expand("${@d.getVar('foo', True) + ' ${bar}'}")
- self.assertEqual(str(val), "${@d.getVar('foo', True) + ' ${unsetvar}'}")
+ val = self.d.expand("${@d.getVar('foo') + ' ${bar}'}")
+ self.assertEqual(str(val), "${@d.getVar('foo') + ' ${unsetvar}'}")
def test_python_snippet_syntax_error(self):
self.d.setVar("FOO", "${@foo = 5}")
@@ -99,7 +99,7 @@ class DataExpansions(unittest.TestCase):
self.assertRaises(bb.data_smart.ExpansionError, self.d.getVar, "FOO", True)
def test_value_containing_value(self):
- val = self.d.expand("${@d.getVar('foo', True) + ' ${bar}'}")
+ val = self.d.expand("${@d.getVar('foo') + ' ${bar}'}")
self.assertEqual(str(val), "value_of_foo value_of_bar")
def test_reference_undefined_var(self):
@@ -109,7 +109,7 @@ class DataExpansions(unittest.TestCase):
def test_double_reference(self):
self.d.setVar("BAR", "bar value")
self.d.setVar("FOO", "${BAR} foo ${BAR}")
- val = self.d.getVar("FOO", True)
+ val = self.d.getVar("FOO")
self.assertEqual(str(val), "bar value foo bar value")
def test_direct_recursion(self):
@@ -129,12 +129,12 @@ class DataExpansions(unittest.TestCase):
def test_incomplete_varexp_single_quotes(self):
self.d.setVar("FOO", "sed -i -e 's:IP{:I${:g' $pc")
- val = self.d.getVar("FOO", True)
+ val = self.d.getVar("FOO")
self.assertEqual(str(val), "sed -i -e 's:IP{:I${:g' $pc")
def test_nonstring(self):
self.d.setVar("TEST", 5)
- val = self.d.getVar("TEST", True)
+ val = self.d.getVar("TEST")
self.assertEqual(str(val), "5")
def test_rename(self):
@@ -234,19 +234,19 @@ class TestConcat(unittest.TestCase):
def test_prepend(self):
self.d.setVar("TEST", "${VAL}")
self.d.prependVar("TEST", "${FOO}:")
- self.assertEqual(self.d.getVar("TEST", True), "foo:val")
+ self.assertEqual(self.d.getVar("TEST"), "foo:val")
def test_append(self):
self.d.setVar("TEST", "${VAL}")
self.d.appendVar("TEST", ":${BAR}")
- self.assertEqual(self.d.getVar("TEST", True), "val:bar")
+ self.assertEqual(self.d.getVar("TEST"), "val:bar")
def test_multiple_append(self):
self.d.setVar("TEST", "${VAL}")
self.d.prependVar("TEST", "${FOO}:")
self.d.appendVar("TEST", ":val2")
self.d.appendVar("TEST", ":${BAR}")
- self.assertEqual(self.d.getVar("TEST", True), "foo:val:val2:bar")
+ self.assertEqual(self.d.getVar("TEST"), "foo:val:val2:bar")
class TestConcatOverride(unittest.TestCase):
def setUp(self):
@@ -259,13 +259,13 @@ class TestConcatOverride(unittest.TestCase):
self.d.setVar("TEST", "${VAL}")
self.d.setVar("TEST_prepend", "${FOO}:")
bb.data.update_data(self.d)
- self.assertEqual(self.d.getVar("TEST", True), "foo:val")
+ self.assertEqual(self.d.getVar("TEST"), "foo:val")
def test_append(self):
self.d.setVar("TEST", "${VAL}")
self.d.setVar("TEST_append", ":${BAR}")
bb.data.update_data(self.d)
- self.assertEqual(self.d.getVar("TEST", True), "val:bar")
+ self.assertEqual(self.d.getVar("TEST"), "val:bar")
def test_multiple_append(self):
self.d.setVar("TEST", "${VAL}")
@@ -273,47 +273,47 @@ class TestConcatOverride(unittest.TestCase):
self.d.setVar("TEST_append", ":val2")
self.d.setVar("TEST_append", ":${BAR}")
bb.data.update_data(self.d)
- self.assertEqual(self.d.getVar("TEST", True), "foo:val:val2:bar")
+ self.assertEqual(self.d.getVar("TEST"), "foo:val:val2:bar")
def test_append_unset(self):
self.d.setVar("TEST_prepend", "${FOO}:")
self.d.setVar("TEST_append", ":val2")
self.d.setVar("TEST_append", ":${BAR}")
bb.data.update_data(self.d)
- self.assertEqual(self.d.getVar("TEST", True), "foo::val2:bar")
+ self.assertEqual(self.d.getVar("TEST"), "foo::val2:bar")
def test_remove(self):
self.d.setVar("TEST", "${VAL} ${BAR}")
self.d.setVar("TEST_remove", "val")
bb.data.update_data(self.d)
- self.assertEqual(self.d.getVar("TEST", True), "bar")
+ self.assertEqual(self.d.getVar("TEST"), "bar")
def test_doubleref_remove(self):
self.d.setVar("TEST", "${VAL} ${BAR}")
self.d.setVar("TEST_remove", "val")
self.d.setVar("TEST_TEST", "${TEST} ${TEST}")
bb.data.update_data(self.d)
- self.assertEqual(self.d.getVar("TEST_TEST", True), "bar bar")
+ self.assertEqual(self.d.getVar("TEST_TEST"), "bar bar")
def test_empty_remove(self):
self.d.setVar("TEST", "")
self.d.setVar("TEST_remove", "val")
bb.data.update_data(self.d)
- self.assertEqual(self.d.getVar("TEST", True), "")
+ self.assertEqual(self.d.getVar("TEST"), "")
def test_remove_expansion(self):
self.d.setVar("BAR", "Z")
self.d.setVar("TEST", "${BAR}/X Y")
self.d.setVar("TEST_remove", "${BAR}/X")
bb.data.update_data(self.d)
- self.assertEqual(self.d.getVar("TEST", True), "Y")
+ self.assertEqual(self.d.getVar("TEST"), "Y")
def test_remove_expansion_items(self):
self.d.setVar("TEST", "A B C D")
self.d.setVar("BAR", "B D")
self.d.setVar("TEST_remove", "${BAR}")
bb.data.update_data(self.d)
- self.assertEqual(self.d.getVar("TEST", True), "A C")
+ self.assertEqual(self.d.getVar("TEST"), "A C")
class TestOverrides(unittest.TestCase):
def setUp(self):
@@ -323,17 +323,17 @@ class TestOverrides(unittest.TestCase):
def test_no_override(self):
bb.data.update_data(self.d)
- self.assertEqual(self.d.getVar("TEST", True), "testvalue")
+ self.assertEqual(self.d.getVar("TEST"), "testvalue")
def test_one_override(self):
self.d.setVar("TEST_bar", "testvalue2")
bb.data.update_data(self.d)
- self.assertEqual(self.d.getVar("TEST", True), "testvalue2")
+ self.assertEqual(self.d.getVar("TEST"), "testvalue2")
def test_one_override_unset(self):
self.d.setVar("TEST2_bar", "testvalue2")
bb.data.update_data(self.d)
- self.assertEqual(self.d.getVar("TEST2", True), "testvalue2")
+ self.assertEqual(self.d.getVar("TEST2"), "testvalue2")
self.assertCountEqual(list(self.d.keys()), ['TEST', 'TEST2', 'OVERRIDES', 'TEST2_bar'])
def test_multiple_override(self):
@@ -341,18 +341,18 @@ class TestOverrides(unittest.TestCase):
self.d.setVar("TEST_local", "testvalue3")
self.d.setVar("TEST_foo", "testvalue4")
bb.data.update_data(self.d)
- self.assertEqual(self.d.getVar("TEST", True), "testvalue3")
+ self.assertEqual(self.d.getVar("TEST"), "testvalue3")
self.assertCountEqual(list(self.d.keys()), ['TEST', 'TEST_foo', 'OVERRIDES', 'TEST_bar', 'TEST_local'])
def test_multiple_combined_overrides(self):
self.d.setVar("TEST_local_foo_bar", "testvalue3")
bb.data.update_data(self.d)
- self.assertEqual(self.d.getVar("TEST", True), "testvalue3")
+ self.assertEqual(self.d.getVar("TEST"), "testvalue3")
def test_multiple_overrides_unset(self):
self.d.setVar("TEST2_local_foo_bar", "testvalue3")
bb.data.update_data(self.d)
- self.assertEqual(self.d.getVar("TEST2", True), "testvalue3")
+ self.assertEqual(self.d.getVar("TEST2"), "testvalue3")
def test_keyexpansion_override(self):
self.d.setVar("LOCAL", "local")
@@ -361,21 +361,21 @@ class TestOverrides(unittest.TestCase):
self.d.setVar("TEST_foo", "testvalue4")
bb.data.update_data(self.d)
bb.data.expandKeys(self.d)
- self.assertEqual(self.d.getVar("TEST", True), "testvalue3")
+ self.assertEqual(self.d.getVar("TEST"), "testvalue3")
def test_rename_override(self):
self.d.setVar("ALTERNATIVE_ncurses-tools_class-target", "a")
self.d.setVar("OVERRIDES", "class-target")
bb.data.update_data(self.d)
self.d.renameVar("ALTERNATIVE_ncurses-tools", "ALTERNATIVE_lib32-ncurses-tools")
- self.assertEqual(self.d.getVar("ALTERNATIVE_lib32-ncurses-tools", True), "a")
+ self.assertEqual(self.d.getVar("ALTERNATIVE_lib32-ncurses-tools"), "a")
def test_underscore_override(self):
self.d.setVar("TEST_bar", "testvalue2")
self.d.setVar("TEST_some_val", "testvalue3")
self.d.setVar("TEST_foo", "testvalue4")
self.d.setVar("OVERRIDES", "foo:bar:some_val")
- self.assertEqual(self.d.getVar("TEST", True), "testvalue3")
+ self.assertEqual(self.d.getVar("TEST"), "testvalue3")
class TestKeyExpansion(unittest.TestCase):
def setUp(self):
@@ -389,7 +389,7 @@ class TestKeyExpansion(unittest.TestCase):
with LogRecord() as logs:
bb.data.expandKeys(self.d)
self.assertTrue(logContains("Variable key VAL_${FOO} (A) replaces original key VAL_foo (B)", logs))
- self.assertEqual(self.d.getVar("VAL_foo", True), "A")
+ self.assertEqual(self.d.getVar("VAL_foo"), "A")
class TestFlags(unittest.TestCase):
def setUp(self):
diff --git a/lib/bb/tests/parse.py b/lib/bb/tests/parse.py
index 0b2706af..86e86ed7 100644
--- a/lib/bb/tests/parse.py
+++ b/lib/bb/tests/parse.py
@@ -58,9 +58,9 @@ C = "3"
def test_parse_simple(self):
f = self.parsehelper(self.testfile)
d = bb.parse.handle(f.name, self.d)['']
- self.assertEqual(d.getVar("A", True), "1")
- self.assertEqual(d.getVar("B", True), "2")
- self.assertEqual(d.getVar("C", True), "3")
+ self.assertEqual(d.getVar("A"), "1")
+ self.assertEqual(d.getVar("B"), "2")
+ self.assertEqual(d.getVar("C"), "3")
def test_parse_incomplete_function(self):
testfileB = self.testfile.replace("}", "")
@@ -80,9 +80,9 @@ unset B[flag]
def test_parse_unset(self):
f = self.parsehelper(self.unsettest)
d = bb.parse.handle(f.name, self.d)['']
- self.assertEqual(d.getVar("A", True), None)
+ self.assertEqual(d.getVar("A"), None)
self.assertEqual(d.getVarFlag("A","flag", True), None)
- self.assertEqual(d.getVar("B", True), "2")
+ self.assertEqual(d.getVar("B"), "2")
overridetest = """
@@ -95,11 +95,11 @@ PN = "gtk+"
def test_parse_overrides(self):
f = self.parsehelper(self.overridetest)
d = bb.parse.handle(f.name, self.d)['']
- self.assertEqual(d.getVar("RRECOMMENDS", True), "b")
+ self.assertEqual(d.getVar("RRECOMMENDS"), "b")
bb.data.expandKeys(d)
- self.assertEqual(d.getVar("RRECOMMENDS", True), "b")
+ self.assertEqual(d.getVar("RRECOMMENDS"), "b")
d.setVar("RRECOMMENDS_gtk+", "c")
- self.assertEqual(d.getVar("RRECOMMENDS", True), "c")
+ self.assertEqual(d.getVar("RRECOMMENDS"), "c")
overridetest2 = """
EXTRA_OECONF = ""
@@ -112,7 +112,7 @@ EXTRA_OECONF_append = " c"
d = bb.parse.handle(f.name, self.d)['']
d.appendVar("EXTRA_OECONF", " d")
d.setVar("OVERRIDES", "class-target")
- self.assertEqual(d.getVar("EXTRA_OECONF", True), "b c d")
+ self.assertEqual(d.getVar("EXTRA_OECONF"), "b c d")
overridetest3 = """
DESCRIPTION = "A"
@@ -124,11 +124,11 @@ PN = "bc"
f = self.parsehelper(self.overridetest3)
d = bb.parse.handle(f.name, self.d)['']
bb.data.expandKeys(d)
- self.assertEqual(d.getVar("DESCRIPTION_bc-dev", True), "A B")
+ self.assertEqual(d.getVar("DESCRIPTION_bc-dev"), "A B")
d.setVar("DESCRIPTION", "E")
d.setVar("DESCRIPTION_bc-dev", "C D")
d.setVar("OVERRIDES", "bc-dev")
- self.assertEqual(d.getVar("DESCRIPTION", True), "C D")
+ self.assertEqual(d.getVar("DESCRIPTION"), "C D")
classextend = """
@@ -159,6 +159,6 @@ python () {
alldata = bb.parse.handle(f.name, self.d)
d1 = alldata['']
d2 = alldata[cls.name]
- self.assertEqual(d1.getVar("VAR_var", True), "B")
- self.assertEqual(d2.getVar("VAR_var", True), None)
+ self.assertEqual(d1.getVar("VAR_var"), "B")
+ self.assertEqual(d2.getVar("VAR_var"), None)