summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmiddlek <smiddlek@b1010a0a-674b-0410-b734-77272b80c875>2009-03-20 17:03:34 +0000
committersmiddlek <smiddlek@b1010a0a-674b-0410-b734-77272b80c875>2009-03-20 17:03:34 +0000
commita1c509d6722daa1163441cc545a79248d811e41e (patch)
treee89b513f88a0890bf8657ba85d7b400717d2c13e
parent3394b66def83f9779150ba53f8d462300d7b279a (diff)
downloadmox-a1c509d6722daa1163441cc545a79248d811e41e.tar.gz
Fix for Issue 5, submitted by agoratim.
git-svn-id: http://pymox.googlecode.com/svn/trunk@28 b1010a0a-674b-0410-b734-77272b80c875
-rw-r--r--stubout.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/stubout.py b/stubout.py
index 6d04996..a452241 100644
--- a/stubout.py
+++ b/stubout.py
@@ -118,8 +118,11 @@ class StubOutForTesting:
old_child = getattr(parent, child_name)
old_attribute = parent.__dict__.get(child_name)
- if old_attribute is not None and isinstance(old_attribute, staticmethod):
- old_child = staticmethod(old_child)
+ if old_attribute is not None:
+ if isinstance(old_attribute, staticmethod):
+ old_child = staticmethod(old_child)
+ elif isinstance(old_attribute, classmethod):
+ old_child = classmethod(old_child.im_func)
self.cache.append((parent, old_child, child_name))
setattr(parent, child_name, new_child)