diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-12 08:30:35 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-06-02 08:24:02 +0100 |
commit | 0f2c59367a649de5f57acdccfb4f1fdba9cde730 (patch) | |
tree | 7a3558a3e08e690fbb0b5bdc4044316f9ab4bbcb /bitbake/lib/bb/tests | |
parent | ef1df516512587ad415f76a9626620992d660e45 (diff) | |
download | poky-0f2c59367a649de5f57acdccfb4f1fdba9cde730.tar.gz |
bitbake: bitbake: Convert to python 3
Various misc changes to convert bitbake to python3 which don't warrant
separation into separate commits.
(Bitbake rev: d0f904d407f57998419bd9c305ce53e5eaa36b24)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tests')
-rw-r--r-- | bitbake/lib/bb/tests/codeparser.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/data.py | 12 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/parse.py | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/bitbake/lib/bb/tests/codeparser.py b/bitbake/lib/bb/tests/codeparser.py index 5ea9d84803..14f0e2572c 100644 --- a/bitbake/lib/bb/tests/codeparser.py +++ b/bitbake/lib/bb/tests/codeparser.py | |||
@@ -191,8 +191,8 @@ class PythonReferenceTest(ReferenceTest): | |||
191 | if hasattr(bb.utils, "_context"): | 191 | if hasattr(bb.utils, "_context"): |
192 | self.context = bb.utils._context | 192 | self.context = bb.utils._context |
193 | else: | 193 | else: |
194 | import __builtin__ | 194 | import builtins |
195 | self.context = __builtin__.__dict__ | 195 | self.context = builtins.__dict__ |
196 | 196 | ||
197 | def parseExpression(self, exp): | 197 | def parseExpression(self, exp): |
198 | parsedvar = self.d.expandWithRefs(exp, None) | 198 | parsedvar = self.d.expandWithRefs(exp, None) |
diff --git a/bitbake/lib/bb/tests/data.py b/bitbake/lib/bb/tests/data.py index 12232305c3..b54eb06797 100644 --- a/bitbake/lib/bb/tests/data.py +++ b/bitbake/lib/bb/tests/data.py | |||
@@ -147,14 +147,14 @@ class DataExpansions(unittest.TestCase): | |||
147 | self.assertEqual(self.d.getVar("foo", False), None) | 147 | self.assertEqual(self.d.getVar("foo", False), None) |
148 | 148 | ||
149 | def test_keys(self): | 149 | def test_keys(self): |
150 | keys = self.d.keys() | 150 | keys = list(self.d.keys()) |
151 | self.assertEqual(keys, ['value_of_foo', 'foo', 'bar']) | 151 | self.assertCountEqual(keys, ['value_of_foo', 'foo', 'bar']) |
152 | 152 | ||
153 | def test_keys_deletion(self): | 153 | def test_keys_deletion(self): |
154 | newd = bb.data.createCopy(self.d) | 154 | newd = bb.data.createCopy(self.d) |
155 | newd.delVar("bar") | 155 | newd.delVar("bar") |
156 | keys = newd.keys() | 156 | keys = list(newd.keys()) |
157 | self.assertEqual(keys, ['value_of_foo', 'foo']) | 157 | self.assertCountEqual(keys, ['value_of_foo', 'foo']) |
158 | 158 | ||
159 | class TestNestedExpansions(unittest.TestCase): | 159 | class TestNestedExpansions(unittest.TestCase): |
160 | def setUp(self): | 160 | def setUp(self): |
@@ -334,7 +334,7 @@ class TestOverrides(unittest.TestCase): | |||
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", True), "testvalue2") |
337 | self.assertItemsEqual(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): |
340 | self.d.setVar("TEST_bar", "testvalue2") | 340 | self.d.setVar("TEST_bar", "testvalue2") |
@@ -342,7 +342,7 @@ class TestOverrides(unittest.TestCase): | |||
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", True), "testvalue3") |
345 | self.assertItemsEqual(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") |
diff --git a/bitbake/lib/bb/tests/parse.py b/bitbake/lib/bb/tests/parse.py index 6beb76a48d..c296db2013 100644 --- a/bitbake/lib/bb/tests/parse.py +++ b/bitbake/lib/bb/tests/parse.py | |||
@@ -50,7 +50,7 @@ C = "3" | |||
50 | def parsehelper(self, content, suffix = ".bb"): | 50 | def parsehelper(self, content, suffix = ".bb"): |
51 | 51 | ||
52 | f = tempfile.NamedTemporaryFile(suffix = suffix) | 52 | f = tempfile.NamedTemporaryFile(suffix = suffix) |
53 | f.write(content) | 53 | f.write(bytes(content, "utf-8")) |
54 | f.flush() | 54 | f.flush() |
55 | os.chdir(os.path.dirname(f.name)) | 55 | os.chdir(os.path.dirname(f.name)) |
56 | return f | 56 | return f |