From 9b9b647c9ddde538d6b5f3a519d09b801ff82193 Mon Sep 17 00:00:00 2001 From: Cyril Roelandt Date: Fri, 7 Mar 2014 04:06:29 +0100 Subject: [PATCH] Python 3: do not use __builtin__ Use six.moves.builtins instead, this works with both Python 2 and 3. Change-Id: I17cdf651edbf7907e2b8b3d6aec9ace8a76b0110 Closes-Bug: 1289107 --- tests/test_shell.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_shell.py b/tests/test_shell.py index 6e9c476..ebe77e0 100644 --- a/tests/test_shell.py +++ b/tests/test_shell.py @@ -136,7 +136,7 @@ class ShellCacheSchemaTest(utils.TestCase): return Args(args) - @mock.patch('__builtin__.open', new=mock.mock_open(), create=True) + @mock.patch('six.moves.builtins.open', new=mock.mock_open(), create=True) def test_cache_schema_gets_when_not_exists(self): mocked_path_exists_result_lst = [True, False] os.path.exists.side_effect = \ @@ -154,7 +154,7 @@ class ShellCacheSchemaTest(utils.TestCase): self.assertEqual(mock.call().write(json.dumps(self.schema_dict)), open.mock_calls[2]) - @mock.patch('__builtin__.open', new=mock.mock_open(), create=True) + @mock.patch('six.moves.builtins.open', new=mock.mock_open(), create=True) def test_cache_schema_gets_when_forced(self): os.path.exists.return_value = True @@ -170,7 +170,7 @@ class ShellCacheSchemaTest(utils.TestCase): self.assertEqual(mock.call().write(json.dumps(self.schema_dict)), open.mock_calls[2]) - @mock.patch('__builtin__.open', new=mock.mock_open(), create=True) + @mock.patch('six.moves.builtins.open', new=mock.mock_open(), create=True) def test_cache_schema_leaves_when_present_not_forced(self): os.path.exists.return_value = True