This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Caris Moses
Recipients Caris Moses, Claudiu.Popa, and, cjw296, iforapsy, kushal.das, mariocj89, michael.foord, xtreak
Date 2019-10-11.20:13:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1570824823.97.0.629660389969.issue21478@roundup.psfhosted.org>
In-reply-to
Content
Hello,
I am still running into this issue. I have tested the following code with Python 3.7.4, 3.7.5rc1 , and 3.8.0rc1.

from unittest import TestCase
from unittest.mock import patch, Mock, call

class MyObject:
    def __init__(self):
        self.foo = 0
        self.bar = 0

    def set_foo(self, value):
        self.foo = value

    def set_bar(self, value):
        self.bar = value

def do_something():
    o = MyObject()
    o.set_foo(3)
    o.set_bar(4)
    return 'something unrelated'

class MyObjectTest(TestCase):

    @patch('test_mock.MyObject.set_bar', autospec=True)
    @patch('test_mock.MyObject.set_foo', autospec=True)
    def test_do_something(self, mock_set_foo, mock_set_bar):
        manager = Mock()
        manager.attach_mock(mock_set_foo, 'set_foo_func')
        manager.attach_mock(mock_set_bar, 'set_bar_func')
        do_something()
        assert manager.mock_calls == [call.set_foo_func(3), call.set_bar_func(4)]
History
Date User Action Args
2019-10-11 20:13:44Caris Mosessetrecipients: + Caris Moses, cjw296, michael.foord, Claudiu.Popa, kushal.das, and, mariocj89, xtreak, iforapsy
2019-10-11 20:13:43Caris Mosessetmessageid: <1570824823.97.0.629660389969.issue21478@roundup.psfhosted.org>
2019-10-11 20:13:43Caris Moseslinkissue21478 messages
2019-10-11 20:13:43Caris Mosescreate