Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
Closed
Description
Bug report
3.12.0a7 changed the behavior ofunittest.mock.PropertyMock
Setup:
from unittest.mock import MagicMock, PropertyMockm = MagicMock()p1 = PropertyMock(return_value=3)p2 = PropertyMock(side_effect=ValueError)type(m).foo = p1type(m).bar = p2In Python 3.12.0a6 and earlier,m.foo evaluates as 3, andm.bar raises a ValueError.
In Python 3.12.0a7,m.foo evaluates as 3, andm.bar returns<MagicMock name='mock.bar' id=...>
Your environment
- CPython versions tested on: 3.12.0a7, 3.12.0a6, 3.11.2, 3.10.10, 3.9.16, 3.8.16
- Operating system and architecture:
- macOS Ventura 13.2.1, on an M1 MacBook Pro.
- GitHub Actions macOS 12 x86_64
- GitHub Actions Ubuntu 22.04
- GitHub Actions Windows Server 2022