You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inheriting from instantiated generic class causes mocking to fail #250
(PS try to trim trailing whitespace when copy/pasting text into github. It causes spurious horizontal scroll bars to appear and weird line breaks. I cleaned it up for you this time.)
Oh, I did not realize I somehow accrued trailing whitespace. Must have been because I pastebin'd it to Jukka then copied from there. Sorry about that :(
Well, a workaround is good enough for now. Thanks! (It has the somewhat unfortunate property that you have to mock all the instantiations being used - but in my case that is only 2 of them, which isn't so bad).
Edit: Confirmation that the workaround indeed works around.
Activity
gvanrossum commentedon Jul 20, 2016
(PS try to trim trailing whitespace when copy/pasting text into github. It causes spurious horizontal scroll bars to appear and weird line breaks. I cleaned it up for you this time.)
jhance commentedon Jul 20, 2016
Oh, I did not realize I somehow accrued trailing whitespace. Must have been because I pastebin'd it to Jukka then copied from there. Sorry about that :(
gvanrossum commentedon Jul 20, 2016
Anyway, I do think this is a bug, but I don't know how to fix it. Looking at the MRO for Foo, we have:
I think the double occurrence of Bar may be the problem -- you're patching the original, but the MRO search finds the unpatched copy in Bar[int].
I think here's a workaround:
jhance commentedon Jul 20, 2016
I see.
Well, a workaround is good enough for now. Thanks! (It has the somewhat unfortunate property that you have to mock all the instantiations being used - but in my case that is only 2 of them, which isn't so bad).
Edit: Confirmation that the workaround indeed works around.
A real fix for python#250
gvanrossum commentedon Oct 11, 2016
Sorry, this wasn't fixed by #289.
A real fix for issue #250 (failure with mock) (#295)
jhance commentedon Oct 28, 2016
Thanks :D