File: python-2.7.2-compat.patch

package info (click to toggle)
python-mox 0.5.3-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 292 kB
  • sloc: python: 2,670; makefile: 7; sh: 5
file content (20 lines) | stat: -rw-r--r-- 950 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Description: Fix MockObject usage under Python 2.7.2
 Since Python 2.7.2, even old-style classes can override __dir__.
 __dir__ must return a list-like object, but MockAnything.__dir__
 will return a MockMethod. This patch fixes that.
Forwarded: http://code.google.com/p/pymox/issues/detail?id=35
Author: Soren Hansen <soren@ubuntu.com>
Last-Update: 2011-06-06
Index: python-mox-0.5.3/mox.py
===================================================================
--- python-mox-0.5.3.orig/mox.py	2010-04-30 16:56:05.000000000 -0400
+++ python-mox-0.5.3/mox.py	2012-05-24 09:59:31.273974838 -0400
@@ -458,6 +458,8 @@
     Returns:
       A new MockMethod aware of MockAnything's state (record or replay).
     """
+    if method_name == '__dir__':
+      return self.__class__.__dir__.__get__(self, self.__class__)
 
     return MockMethod(method_name, self._expected_calls_queue,
                       self._replay_mode, method_to_mock=method_to_mock,