diff options
Diffstat (limited to 'bitbake/lib/bb/tests')
-rw-r--r-- | bitbake/lib/bb/tests/codeparser.py | 12 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/data.py | 58 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/parse.py | 26 |
3 files changed, 48 insertions, 48 deletions
diff --git a/bitbake/lib/bb/tests/codeparser.py b/bitbake/lib/bb/tests/codeparser.py index b80c315d3d..a681841df3 100644 --- a/bitbake/lib/bb/tests/codeparser.py +++ b/bitbake/lib/bb/tests/codeparser.py | |||
@@ -68,7 +68,7 @@ class VariableReferenceTest(ReferenceTest): | |||
68 | 68 | ||
69 | def test_python_reference(self): | 69 | def test_python_reference(self): |
70 | self.setEmptyVars(["BAR"]) | 70 | self.setEmptyVars(["BAR"]) |
71 | self.parseExpression("${@d.getVar('BAR', True) + 'foo'}") | 71 | self.parseExpression("${@d.getVar('BAR') + 'foo'}") |
72 | self.assertReferences(set(["BAR"])) | 72 | self.assertReferences(set(["BAR"])) |
73 | 73 | ||
74 | class ShellReferenceTest(ReferenceTest): | 74 | class ShellReferenceTest(ReferenceTest): |
@@ -209,17 +209,17 @@ be. These unit tests are testing snippets.""" | |||
209 | return " " + value | 209 | return " " + value |
210 | 210 | ||
211 | def test_getvar_reference(self): | 211 | def test_getvar_reference(self): |
212 | self.parseExpression("d.getVar('foo', True)") | 212 | self.parseExpression("d.getVar('foo')") |
213 | self.assertReferences(set(["foo"])) | 213 | self.assertReferences(set(["foo"])) |
214 | self.assertExecs(set()) | 214 | self.assertExecs(set()) |
215 | 215 | ||
216 | def test_getvar_computed_reference(self): | 216 | def test_getvar_computed_reference(self): |
217 | self.parseExpression("d.getVar('f' + 'o' + 'o', True)") | 217 | self.parseExpression("d.getVar('f' + 'o' + 'o')") |
218 | self.assertReferences(set()) | 218 | self.assertReferences(set()) |
219 | self.assertExecs(set()) | 219 | self.assertExecs(set()) |
220 | 220 | ||
221 | def test_getvar_exec_reference(self): | 221 | def test_getvar_exec_reference(self): |
222 | self.parseExpression("eval('d.getVar(\"foo\", True)')") | 222 | self.parseExpression("eval('d.getVar(\"foo\")')") |
223 | self.assertReferences(set()) | 223 | self.assertReferences(set()) |
224 | self.assertExecs(set(["eval"])) | 224 | self.assertExecs(set(["eval"])) |
225 | 225 | ||
@@ -269,11 +269,11 @@ be. These unit tests are testing snippets.""" | |||
269 | class DependencyReferenceTest(ReferenceTest): | 269 | class DependencyReferenceTest(ReferenceTest): |
270 | 270 | ||
271 | pydata = """ | 271 | pydata = """ |
272 | d.getVar('somevar', True) | 272 | d.getVar('somevar') |
273 | def test(d): | 273 | def test(d): |
274 | foo = 'bar %s' % 'foo' | 274 | foo = 'bar %s' % 'foo' |
275 | def test2(d): | 275 | def test2(d): |
276 | d.getVar(foo, True) | 276 | d.getVar(foo) |
277 | d.getVar('bar', False) | 277 | d.getVar('bar', False) |
278 | test2(d) | 278 | test2(d) |
279 | 279 | ||
diff --git a/bitbake/lib/bb/tests/data.py b/bitbake/lib/bb/tests/data.py index b54eb06797..1a5a28af06 100644 --- a/bitbake/lib/bb/tests/data.py +++ b/bitbake/lib/bb/tests/data.py | |||
@@ -77,13 +77,13 @@ class DataExpansions(unittest.TestCase): | |||
77 | self.assertEqual(str(val), "boo value_of_foo") | 77 | self.assertEqual(str(val), "boo value_of_foo") |
78 | 78 | ||
79 | def test_python_snippet_getvar(self): | 79 | def test_python_snippet_getvar(self): |
80 | val = self.d.expand("${@d.getVar('foo', True) + ' ${bar}'}") | 80 | val = self.d.expand("${@d.getVar('foo') + ' ${bar}'}") |
81 | self.assertEqual(str(val), "value_of_foo value_of_bar") | 81 | self.assertEqual(str(val), "value_of_foo value_of_bar") |
82 | 82 | ||
83 | def test_python_unexpanded(self): | 83 | def test_python_unexpanded(self): |
84 | self.d.setVar("bar", "${unsetvar}") | 84 | self.d.setVar("bar", "${unsetvar}") |
85 | val = self.d.expand("${@d.getVar('foo', True) + ' ${bar}'}") | 85 | val = self.d.expand("${@d.getVar('foo') + ' ${bar}'}") |
86 | self.assertEqual(str(val), "${@d.getVar('foo', True) + ' ${unsetvar}'}") | 86 | self.assertEqual(str(val), "${@d.getVar('foo') + ' ${unsetvar}'}") |
87 | 87 | ||
88 | def test_python_snippet_syntax_error(self): | 88 | def test_python_snippet_syntax_error(self): |
89 | self.d.setVar("FOO", "${@foo = 5}") | 89 | self.d.setVar("FOO", "${@foo = 5}") |
@@ -99,7 +99,7 @@ class DataExpansions(unittest.TestCase): | |||
99 | self.assertRaises(bb.data_smart.ExpansionError, self.d.getVar, "FOO", True) | 99 | self.assertRaises(bb.data_smart.ExpansionError, self.d.getVar, "FOO", True) |
100 | 100 | ||
101 | def test_value_containing_value(self): | 101 | def test_value_containing_value(self): |
102 | val = self.d.expand("${@d.getVar('foo', True) + ' ${bar}'}") | 102 | val = self.d.expand("${@d.getVar('foo') + ' ${bar}'}") |
103 | self.assertEqual(str(val), "value_of_foo value_of_bar") | 103 | self.assertEqual(str(val), "value_of_foo value_of_bar") |
104 | 104 | ||
105 | def test_reference_undefined_var(self): | 105 | def test_reference_undefined_var(self): |
@@ -109,7 +109,7 @@ class DataExpansions(unittest.TestCase): | |||
109 | def test_double_reference(self): | 109 | def test_double_reference(self): |
110 | self.d.setVar("BAR", "bar value") | 110 | self.d.setVar("BAR", "bar value") |
111 | self.d.setVar("FOO", "${BAR} foo ${BAR}") | 111 | self.d.setVar("FOO", "${BAR} foo ${BAR}") |
112 | val = self.d.getVar("FOO", True) | 112 | val = self.d.getVar("FOO") |
113 | self.assertEqual(str(val), "bar value foo bar value") | 113 | self.assertEqual(str(val), "bar value foo bar value") |
114 | 114 | ||
115 | def test_direct_recursion(self): | 115 | def test_direct_recursion(self): |
@@ -129,12 +129,12 @@ class DataExpansions(unittest.TestCase): | |||
129 | 129 | ||
130 | def test_incomplete_varexp_single_quotes(self): | 130 | def test_incomplete_varexp_single_quotes(self): |
131 | self.d.setVar("FOO", "sed -i -e 's:IP{:I${:g' $pc") | 131 | self.d.setVar("FOO", "sed -i -e 's:IP{:I${:g' $pc") |
132 | val = self.d.getVar("FOO", True) | 132 | val = self.d.getVar("FOO") |
133 | self.assertEqual(str(val), "sed -i -e 's:IP{:I${:g' $pc") | 133 | self.assertEqual(str(val), "sed -i -e 's:IP{:I${:g' $pc") |
134 | 134 | ||
135 | def test_nonstring(self): | 135 | def test_nonstring(self): |
136 | self.d.setVar("TEST", 5) | 136 | self.d.setVar("TEST", 5) |
137 | val = self.d.getVar("TEST", True) | 137 | val = self.d.getVar("TEST") |
138 | self.assertEqual(str(val), "5") | 138 | self.assertEqual(str(val), "5") |
139 | 139 | ||
140 | def test_rename(self): | 140 | def test_rename(self): |
@@ -234,19 +234,19 @@ class TestConcat(unittest.TestCase): | |||
234 | def test_prepend(self): | 234 | def test_prepend(self): |
235 | self.d.setVar("TEST", "${VAL}") | 235 | self.d.setVar("TEST", "${VAL}") |
236 | self.d.prependVar("TEST", "${FOO}:") | 236 | self.d.prependVar("TEST", "${FOO}:") |
237 | self.assertEqual(self.d.getVar("TEST", True), "foo:val") | 237 | self.assertEqual(self.d.getVar("TEST"), "foo:val") |
238 | 238 | ||
239 | def test_append(self): | 239 | def test_append(self): |
240 | self.d.setVar("TEST", "${VAL}") | 240 | self.d.setVar("TEST", "${VAL}") |
241 | self.d.appendVar("TEST", ":${BAR}") | 241 | self.d.appendVar("TEST", ":${BAR}") |
242 | self.assertEqual(self.d.getVar("TEST", True), "val:bar") | 242 | self.assertEqual(self.d.getVar("TEST"), "val:bar") |
243 | 243 | ||
244 | def test_multiple_append(self): | 244 | def test_multiple_append(self): |
245 | self.d.setVar("TEST", "${VAL}") | 245 | self.d.setVar("TEST", "${VAL}") |
246 | self.d.prependVar("TEST", "${FOO}:") | 246 | self.d.prependVar("TEST", "${FOO}:") |
247 | self.d.appendVar("TEST", ":val2") | 247 | self.d.appendVar("TEST", ":val2") |
248 | self.d.appendVar("TEST", ":${BAR}") | 248 | self.d.appendVar("TEST", ":${BAR}") |
249 | self.assertEqual(self.d.getVar("TEST", True), "foo:val:val2:bar") | 249 | self.assertEqual(self.d.getVar("TEST"), "foo:val:val2:bar") |
250 | 250 | ||
251 | class TestConcatOverride(unittest.TestCase): | 251 | class TestConcatOverride(unittest.TestCase): |
252 | def setUp(self): | 252 | def setUp(self): |
@@ -259,13 +259,13 @@ class TestConcatOverride(unittest.TestCase): | |||
259 | self.d.setVar("TEST", "${VAL}") | 259 | self.d.setVar("TEST", "${VAL}") |
260 | self.d.setVar("TEST_prepend", "${FOO}:") | 260 | self.d.setVar("TEST_prepend", "${FOO}:") |
261 | bb.data.update_data(self.d) | 261 | bb.data.update_data(self.d) |
262 | self.assertEqual(self.d.getVar("TEST", True), "foo:val") | 262 | self.assertEqual(self.d.getVar("TEST"), "foo:val") |
263 | 263 | ||
264 | def test_append(self): | 264 | def test_append(self): |
265 | self.d.setVar("TEST", "${VAL}") | 265 | self.d.setVar("TEST", "${VAL}") |
266 | self.d.setVar("TEST_append", ":${BAR}") | 266 | self.d.setVar("TEST_append", ":${BAR}") |
267 | bb.data.update_data(self.d) | 267 | bb.data.update_data(self.d) |
268 | self.assertEqual(self.d.getVar("TEST", True), "val:bar") | 268 | self.assertEqual(self.d.getVar("TEST"), "val:bar") |
269 | 269 | ||
270 | def test_multiple_append(self): | 270 | def test_multiple_append(self): |
271 | self.d.setVar("TEST", "${VAL}") | 271 | self.d.setVar("TEST", "${VAL}") |
@@ -273,47 +273,47 @@ class TestConcatOverride(unittest.TestCase): | |||
273 | self.d.setVar("TEST_append", ":val2") | 273 | self.d.setVar("TEST_append", ":val2") |
274 | self.d.setVar("TEST_append", ":${BAR}") | 274 | self.d.setVar("TEST_append", ":${BAR}") |
275 | bb.data.update_data(self.d) | 275 | bb.data.update_data(self.d) |
276 | self.assertEqual(self.d.getVar("TEST", True), "foo:val:val2:bar") | 276 | self.assertEqual(self.d.getVar("TEST"), "foo:val:val2:bar") |
277 | 277 | ||
278 | def test_append_unset(self): | 278 | def test_append_unset(self): |
279 | self.d.setVar("TEST_prepend", "${FOO}:") | 279 | self.d.setVar("TEST_prepend", "${FOO}:") |
280 | self.d.setVar("TEST_append", ":val2") | 280 | self.d.setVar("TEST_append", ":val2") |
281 | self.d.setVar("TEST_append", ":${BAR}") | 281 | self.d.setVar("TEST_append", ":${BAR}") |
282 | bb.data.update_data(self.d) | 282 | bb.data.update_data(self.d) |
283 | self.assertEqual(self.d.getVar("TEST", True), "foo::val2:bar") | 283 | self.assertEqual(self.d.getVar("TEST"), "foo::val2:bar") |
284 | 284 | ||
285 | def test_remove(self): | 285 | def test_remove(self): |
286 | self.d.setVar("TEST", "${VAL} ${BAR}") | 286 | self.d.setVar("TEST", "${VAL} ${BAR}") |
287 | self.d.setVar("TEST_remove", "val") | 287 | self.d.setVar("TEST_remove", "val") |
288 | bb.data.update_data(self.d) | 288 | bb.data.update_data(self.d) |
289 | self.assertEqual(self.d.getVar("TEST", True), "bar") | 289 | self.assertEqual(self.d.getVar("TEST"), "bar") |
290 | 290 | ||
291 | def test_doubleref_remove(self): | 291 | def test_doubleref_remove(self): |
292 | self.d.setVar("TEST", "${VAL} ${BAR}") | 292 | self.d.setVar("TEST", "${VAL} ${BAR}") |
293 | self.d.setVar("TEST_remove", "val") | 293 | self.d.setVar("TEST_remove", "val") |
294 | self.d.setVar("TEST_TEST", "${TEST} ${TEST}") | 294 | self.d.setVar("TEST_TEST", "${TEST} ${TEST}") |
295 | bb.data.update_data(self.d) | 295 | bb.data.update_data(self.d) |
296 | self.assertEqual(self.d.getVar("TEST_TEST", True), "bar bar") | 296 | self.assertEqual(self.d.getVar("TEST_TEST"), "bar bar") |
297 | 297 | ||
298 | def test_empty_remove(self): | 298 | def test_empty_remove(self): |
299 | self.d.setVar("TEST", "") | 299 | self.d.setVar("TEST", "") |
300 | self.d.setVar("TEST_remove", "val") | 300 | self.d.setVar("TEST_remove", "val") |
301 | bb.data.update_data(self.d) | 301 | bb.data.update_data(self.d) |
302 | self.assertEqual(self.d.getVar("TEST", True), "") | 302 | self.assertEqual(self.d.getVar("TEST"), "") |
303 | 303 | ||
304 | def test_remove_expansion(self): | 304 | def test_remove_expansion(self): |
305 | self.d.setVar("BAR", "Z") | 305 | self.d.setVar("BAR", "Z") |
306 | self.d.setVar("TEST", "${BAR}/X Y") | 306 | self.d.setVar("TEST", "${BAR}/X Y") |
307 | self.d.setVar("TEST_remove", "${BAR}/X") | 307 | self.d.setVar("TEST_remove", "${BAR}/X") |
308 | bb.data.update_data(self.d) | 308 | bb.data.update_data(self.d) |
309 | self.assertEqual(self.d.getVar("TEST", True), "Y") | 309 | self.assertEqual(self.d.getVar("TEST"), "Y") |
310 | 310 | ||
311 | def test_remove_expansion_items(self): | 311 | def test_remove_expansion_items(self): |
312 | self.d.setVar("TEST", "A B C D") | 312 | self.d.setVar("TEST", "A B C D") |
313 | self.d.setVar("BAR", "B D") | 313 | self.d.setVar("BAR", "B D") |
314 | self.d.setVar("TEST_remove", "${BAR}") | 314 | self.d.setVar("TEST_remove", "${BAR}") |
315 | bb.data.update_data(self.d) | 315 | bb.data.update_data(self.d) |
316 | self.assertEqual(self.d.getVar("TEST", True), "A C") | 316 | self.assertEqual(self.d.getVar("TEST"), "A C") |
317 | 317 | ||
318 | class TestOverrides(unittest.TestCase): | 318 | class TestOverrides(unittest.TestCase): |
319 | def setUp(self): | 319 | def setUp(self): |
@@ -323,17 +323,17 @@ class TestOverrides(unittest.TestCase): | |||
323 | 323 | ||
324 | def test_no_override(self): | 324 | def test_no_override(self): |
325 | bb.data.update_data(self.d) | 325 | bb.data.update_data(self.d) |
326 | self.assertEqual(self.d.getVar("TEST", True), "testvalue") | 326 | self.assertEqual(self.d.getVar("TEST"), "testvalue") |
327 | 327 | ||
328 | def test_one_override(self): | 328 | def test_one_override(self): |
329 | self.d.setVar("TEST_bar", "testvalue2") | 329 | self.d.setVar("TEST_bar", "testvalue2") |
330 | bb.data.update_data(self.d) | 330 | bb.data.update_data(self.d) |
331 | self.assertEqual(self.d.getVar("TEST", True), "testvalue2") | 331 | self.assertEqual(self.d.getVar("TEST"), "testvalue2") |
332 | 332 | ||
333 | def test_one_override_unset(self): | 333 | def test_one_override_unset(self): |
334 | self.d.setVar("TEST2_bar", "testvalue2") | 334 | self.d.setVar("TEST2_bar", "testvalue2") |
335 | bb.data.update_data(self.d) | 335 | bb.data.update_data(self.d) |
336 | self.assertEqual(self.d.getVar("TEST2", True), "testvalue2") | 336 | self.assertEqual(self.d.getVar("TEST2"), "testvalue2") |
337 | self.assertCountEqual(list(self.d.keys()), ['TEST', 'TEST2', 'OVERRIDES', 'TEST2_bar']) | 337 | self.assertCountEqual(list(self.d.keys()), ['TEST', 'TEST2', 'OVERRIDES', 'TEST2_bar']) |
338 | 338 | ||
339 | def test_multiple_override(self): | 339 | def test_multiple_override(self): |
@@ -341,18 +341,18 @@ class TestOverrides(unittest.TestCase): | |||
341 | self.d.setVar("TEST_local", "testvalue3") | 341 | self.d.setVar("TEST_local", "testvalue3") |
342 | self.d.setVar("TEST_foo", "testvalue4") | 342 | self.d.setVar("TEST_foo", "testvalue4") |
343 | bb.data.update_data(self.d) | 343 | bb.data.update_data(self.d) |
344 | self.assertEqual(self.d.getVar("TEST", True), "testvalue3") | 344 | self.assertEqual(self.d.getVar("TEST"), "testvalue3") |
345 | self.assertCountEqual(list(self.d.keys()), ['TEST', 'TEST_foo', 'OVERRIDES', 'TEST_bar', 'TEST_local']) | 345 | self.assertCountEqual(list(self.d.keys()), ['TEST', 'TEST_foo', 'OVERRIDES', 'TEST_bar', 'TEST_local']) |
346 | 346 | ||
347 | def test_multiple_combined_overrides(self): | 347 | def test_multiple_combined_overrides(self): |
348 | self.d.setVar("TEST_local_foo_bar", "testvalue3") | 348 | self.d.setVar("TEST_local_foo_bar", "testvalue3") |
349 | bb.data.update_data(self.d) | 349 | bb.data.update_data(self.d) |
350 | self.assertEqual(self.d.getVar("TEST", True), "testvalue3") | 350 | self.assertEqual(self.d.getVar("TEST"), "testvalue3") |
351 | 351 | ||
352 | def test_multiple_overrides_unset(self): | 352 | def test_multiple_overrides_unset(self): |
353 | self.d.setVar("TEST2_local_foo_bar", "testvalue3") | 353 | self.d.setVar("TEST2_local_foo_bar", "testvalue3") |
354 | bb.data.update_data(self.d) | 354 | bb.data.update_data(self.d) |
355 | self.assertEqual(self.d.getVar("TEST2", True), "testvalue3") | 355 | self.assertEqual(self.d.getVar("TEST2"), "testvalue3") |
356 | 356 | ||
357 | def test_keyexpansion_override(self): | 357 | def test_keyexpansion_override(self): |
358 | self.d.setVar("LOCAL", "local") | 358 | self.d.setVar("LOCAL", "local") |
@@ -361,21 +361,21 @@ class TestOverrides(unittest.TestCase): | |||
361 | self.d.setVar("TEST_foo", "testvalue4") | 361 | self.d.setVar("TEST_foo", "testvalue4") |
362 | bb.data.update_data(self.d) | 362 | bb.data.update_data(self.d) |
363 | bb.data.expandKeys(self.d) | 363 | bb.data.expandKeys(self.d) |
364 | self.assertEqual(self.d.getVar("TEST", True), "testvalue3") | 364 | self.assertEqual(self.d.getVar("TEST"), "testvalue3") |
365 | 365 | ||
366 | def test_rename_override(self): | 366 | def test_rename_override(self): |
367 | self.d.setVar("ALTERNATIVE_ncurses-tools_class-target", "a") | 367 | self.d.setVar("ALTERNATIVE_ncurses-tools_class-target", "a") |
368 | self.d.setVar("OVERRIDES", "class-target") | 368 | self.d.setVar("OVERRIDES", "class-target") |
369 | bb.data.update_data(self.d) | 369 | bb.data.update_data(self.d) |
370 | self.d.renameVar("ALTERNATIVE_ncurses-tools", "ALTERNATIVE_lib32-ncurses-tools") | 370 | self.d.renameVar("ALTERNATIVE_ncurses-tools", "ALTERNATIVE_lib32-ncurses-tools") |
371 | self.assertEqual(self.d.getVar("ALTERNATIVE_lib32-ncurses-tools", True), "a") | 371 | self.assertEqual(self.d.getVar("ALTERNATIVE_lib32-ncurses-tools"), "a") |
372 | 372 | ||
373 | def test_underscore_override(self): | 373 | def test_underscore_override(self): |
374 | self.d.setVar("TEST_bar", "testvalue2") | 374 | self.d.setVar("TEST_bar", "testvalue2") |
375 | self.d.setVar("TEST_some_val", "testvalue3") | 375 | self.d.setVar("TEST_some_val", "testvalue3") |
376 | self.d.setVar("TEST_foo", "testvalue4") | 376 | self.d.setVar("TEST_foo", "testvalue4") |
377 | self.d.setVar("OVERRIDES", "foo:bar:some_val") | 377 | self.d.setVar("OVERRIDES", "foo:bar:some_val") |
378 | self.assertEqual(self.d.getVar("TEST", True), "testvalue3") | 378 | self.assertEqual(self.d.getVar("TEST"), "testvalue3") |
379 | 379 | ||
380 | class TestKeyExpansion(unittest.TestCase): | 380 | class TestKeyExpansion(unittest.TestCase): |
381 | def setUp(self): | 381 | def setUp(self): |
@@ -389,7 +389,7 @@ class TestKeyExpansion(unittest.TestCase): | |||
389 | with LogRecord() as logs: | 389 | with LogRecord() as logs: |
390 | bb.data.expandKeys(self.d) | 390 | bb.data.expandKeys(self.d) |
391 | self.assertTrue(logContains("Variable key VAL_${FOO} (A) replaces original key VAL_foo (B)", logs)) | 391 | self.assertTrue(logContains("Variable key VAL_${FOO} (A) replaces original key VAL_foo (B)", logs)) |
392 | self.assertEqual(self.d.getVar("VAL_foo", True), "A") | 392 | self.assertEqual(self.d.getVar("VAL_foo"), "A") |
393 | 393 | ||
394 | class TestFlags(unittest.TestCase): | 394 | class TestFlags(unittest.TestCase): |
395 | def setUp(self): | 395 | def setUp(self): |
diff --git a/bitbake/lib/bb/tests/parse.py b/bitbake/lib/bb/tests/parse.py index 0b2706af02..86e86ed711 100644 --- a/bitbake/lib/bb/tests/parse.py +++ b/bitbake/lib/bb/tests/parse.py | |||
@@ -58,9 +58,9 @@ C = "3" | |||
58 | def test_parse_simple(self): | 58 | def test_parse_simple(self): |
59 | f = self.parsehelper(self.testfile) | 59 | f = self.parsehelper(self.testfile) |
60 | d = bb.parse.handle(f.name, self.d)[''] | 60 | d = bb.parse.handle(f.name, self.d)[''] |
61 | self.assertEqual(d.getVar("A", True), "1") | 61 | self.assertEqual(d.getVar("A"), "1") |
62 | self.assertEqual(d.getVar("B", True), "2") | 62 | self.assertEqual(d.getVar("B"), "2") |
63 | self.assertEqual(d.getVar("C", True), "3") | 63 | self.assertEqual(d.getVar("C"), "3") |
64 | 64 | ||
65 | def test_parse_incomplete_function(self): | 65 | def test_parse_incomplete_function(self): |
66 | testfileB = self.testfile.replace("}", "") | 66 | testfileB = self.testfile.replace("}", "") |
@@ -80,9 +80,9 @@ unset B[flag] | |||
80 | def test_parse_unset(self): | 80 | def test_parse_unset(self): |
81 | f = self.parsehelper(self.unsettest) | 81 | f = self.parsehelper(self.unsettest) |
82 | d = bb.parse.handle(f.name, self.d)[''] | 82 | d = bb.parse.handle(f.name, self.d)[''] |
83 | self.assertEqual(d.getVar("A", True), None) | 83 | self.assertEqual(d.getVar("A"), None) |
84 | self.assertEqual(d.getVarFlag("A","flag", True), None) | 84 | self.assertEqual(d.getVarFlag("A","flag", True), None) |
85 | self.assertEqual(d.getVar("B", True), "2") | 85 | self.assertEqual(d.getVar("B"), "2") |
86 | 86 | ||
87 | 87 | ||
88 | overridetest = """ | 88 | overridetest = """ |
@@ -95,11 +95,11 @@ PN = "gtk+" | |||
95 | def test_parse_overrides(self): | 95 | def test_parse_overrides(self): |
96 | f = self.parsehelper(self.overridetest) | 96 | f = self.parsehelper(self.overridetest) |
97 | d = bb.parse.handle(f.name, self.d)[''] | 97 | d = bb.parse.handle(f.name, self.d)[''] |
98 | self.assertEqual(d.getVar("RRECOMMENDS", True), "b") | 98 | self.assertEqual(d.getVar("RRECOMMENDS"), "b") |
99 | bb.data.expandKeys(d) | 99 | bb.data.expandKeys(d) |
100 | self.assertEqual(d.getVar("RRECOMMENDS", True), "b") | 100 | self.assertEqual(d.getVar("RRECOMMENDS"), "b") |
101 | d.setVar("RRECOMMENDS_gtk+", "c") | 101 | d.setVar("RRECOMMENDS_gtk+", "c") |
102 | self.assertEqual(d.getVar("RRECOMMENDS", True), "c") | 102 | self.assertEqual(d.getVar("RRECOMMENDS"), "c") |
103 | 103 | ||
104 | overridetest2 = """ | 104 | overridetest2 = """ |
105 | EXTRA_OECONF = "" | 105 | EXTRA_OECONF = "" |
@@ -112,7 +112,7 @@ EXTRA_OECONF_append = " c" | |||
112 | d = bb.parse.handle(f.name, self.d)[''] | 112 | d = bb.parse.handle(f.name, self.d)[''] |
113 | d.appendVar("EXTRA_OECONF", " d") | 113 | d.appendVar("EXTRA_OECONF", " d") |
114 | d.setVar("OVERRIDES", "class-target") | 114 | d.setVar("OVERRIDES", "class-target") |
115 | self.assertEqual(d.getVar("EXTRA_OECONF", True), "b c d") | 115 | self.assertEqual(d.getVar("EXTRA_OECONF"), "b c d") |
116 | 116 | ||
117 | overridetest3 = """ | 117 | overridetest3 = """ |
118 | DESCRIPTION = "A" | 118 | DESCRIPTION = "A" |
@@ -124,11 +124,11 @@ PN = "bc" | |||
124 | f = self.parsehelper(self.overridetest3) | 124 | f = self.parsehelper(self.overridetest3) |
125 | d = bb.parse.handle(f.name, self.d)[''] | 125 | d = bb.parse.handle(f.name, self.d)[''] |
126 | bb.data.expandKeys(d) | 126 | bb.data.expandKeys(d) |
127 | self.assertEqual(d.getVar("DESCRIPTION_bc-dev", True), "A B") | 127 | self.assertEqual(d.getVar("DESCRIPTION_bc-dev"), "A B") |
128 | d.setVar("DESCRIPTION", "E") | 128 | d.setVar("DESCRIPTION", "E") |
129 | d.setVar("DESCRIPTION_bc-dev", "C D") | 129 | d.setVar("DESCRIPTION_bc-dev", "C D") |
130 | d.setVar("OVERRIDES", "bc-dev") | 130 | d.setVar("OVERRIDES", "bc-dev") |
131 | self.assertEqual(d.getVar("DESCRIPTION", True), "C D") | 131 | self.assertEqual(d.getVar("DESCRIPTION"), "C D") |
132 | 132 | ||
133 | 133 | ||
134 | classextend = """ | 134 | classextend = """ |
@@ -159,6 +159,6 @@ python () { | |||
159 | alldata = bb.parse.handle(f.name, self.d) | 159 | alldata = bb.parse.handle(f.name, self.d) |
160 | d1 = alldata[''] | 160 | d1 = alldata[''] |
161 | d2 = alldata[cls.name] | 161 | d2 = alldata[cls.name] |
162 | self.assertEqual(d1.getVar("VAR_var", True), "B") | 162 | self.assertEqual(d1.getVar("VAR_var"), "B") |
163 | self.assertEqual(d2.getVar("VAR_var", True), None) | 163 | self.assertEqual(d2.getVar("VAR_var"), None) |
164 | 164 | ||