[Piglit] [PATCH 37/44] unittests/options_tests.py: fix mocking for python 3.x

baker.dylan.c at gmail.com baker.dylan.c at gmail.com
Wed Jan 27 16:06:45 PST 2016


From: Dylan Baker <baker.dylan.c at gmail.com>

By default the builtins don't appear in the python 3 namespace, and
create=True must be set to make this work.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 unittests/options_tests.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/unittests/options_tests.py b/unittests/options_tests.py
index 3d47610..c11f642 100644
--- a/unittests/options_tests.py
+++ b/unittests/options_tests.py
@@ -132,7 +132,8 @@ class TestReListDescriptor(object):
         """options._ReListDescriptor.__get__: Returns new _ReList if it doesn't exists"""
         nt.eq_(self.test.notexists, self.test.test_notexists)  # pylint: disable=no-member
 
-    @mock.patch('framework.options.setattr', mock.Mock(side_effect=Exception))
+    @mock.patch('framework.options.setattr', mock.Mock(side_effect=Exception),
+                create=True)
     @nt.raises(AttributeError)
     def test_get_not_exists_fail(self):
         """options._ReListDescriptor.__get__: Raises AttributError if name doesn't exist and cant be created"""
-- 
2.7.0



More information about the Piglit mailing list