Unable to mock old-style classes

Bug #702020 reported by Giles Brown
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mocker
Won't Fix
Undecided
Gustavo Niemeyer

Bug Description

import unittest
import mocker

class OldStyle: pass
class NewStyle(object): pass

class TestCase(mocker.MockerTestCase):

    def test_new_style(self):
        mockedclass = self.mocker.replace(NewStyle)
        self.expect(mockedclass())
        self.mocker.replay()
        obj = NewStyle()

    def test_old_style(self):
        mockedclass = self.mocker.replace(OldStyle)
        self.expect(mockedclass())
        self.mocker.replay()
        obj = OldStyle()

if __name__ == '__main__':
    unittest.main()
~

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

The way in which Mocker works internally depends on new style classes for these features. Given that old style
classes are *really* old, and already went away entirely in the 3.X releases, this won't be changed.

Changed in mocker:
assignee: nobody → Gustavo Niemeyer (niemeyer)
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.