Fix broken test and remove Bad test

testStubOutClass_OldStyle has been fixed with a tip
from referenced bug. Also testUnboundMethodsRequiresInstance
was writted before python 3.3 was released and hence worked
only with versions before i believe. This test never worked
with python 2.6/2.7 either. So just nuking it.

Closes-Bug: #1403214
Change-Id: I2b14b9b29122539cf4a101af0dca89c10693b6a3
changes/26/193726/7 0.11.0
Davanum Srinivas 7 years ago committed by Sirushti Murugesan
parent d87a86be69
commit 1d0054badb
  1. 4
  2. 18

@ -910,7 +910,9 @@ class MethodSignatureChecker(object):
except TypeError:
raise ValueError('Could not get argument specification for %r'
% (method,))
if inspect.ismethod(method) or class_to_bind:
if (inspect.ismethod(method) or class_to_bind or (
hasattr(self, '_args') and len(self._args) > 0
and self._args[0] == 'self')):
self._args = self._args[1:] # Skip 'self'.
self._method = method
self._instance = None # May contain the instance this is bound to.

@ -19,12 +19,10 @@
import io
import re
import sys
from mox3 import mox
from mox3.tests import mox_helper
import six
import testtools
@ -772,21 +770,6 @@ class MockAnythingTest(testtools.TestCase):
class MethodCheckerTest(testtools.TestCase):
"""Tests MockMethod's use of MethodChecker method."""
def testUnboundMethodsRequiresInstance(self):
# SKIP TEST IN PYTHON 2.x (Ugly hack for python 2.6)
# REASON: semantics for unbound methods has changed only in Python 3
# so this test in earlier versions is invald
if sys.version_info < (3, 0):
instance = CheckCallTestClass()
method = mox.MockMethod('NoParameters', [], False,
self.assertRaises(AttributeError, method)
self.assertRaises(AttributeError, method, instance, 1)
def testNoParameters(self):
method = mox.MockMethod('NoParameters', [], False,
@ -1908,7 +1891,6 @@ class MoxTest(testtools.TestCase):
# FIXME(dhellmann): Skip this test until someone can debug why it
# fails on python 3.4.
@testtools.skipIf(six.PY3, "This test needs to be fixed for python 3")
def testStubOutClass_OldStyle(self):
"""Test a mocked class whose __init__ returns a Mock."""
self.mox.StubOutWithMock(mox_helper, 'TestClassFromAnotherModule')