-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
The following test fails on Python 3.12.1, but works on 3.11.7 with lomond 0.3.3.
_____________________ test_that_on_ping_responds_with_pong _____________________
session = <ws-session 'wss://example.com/'>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7ffff5c194f0>
def test_that_on_ping_responds_with_pong(session, mocker):
# we don't actually care that much for the whole stack underneath,
# we only want to check whether a certain method was called..
send_pong = mocker.patch(
'lomond.websocket.WebSocket.send_pong'
)
session._send_pong(events.Ping(b'\x00'))
> assert send_pong.called_with(b'\x00')
tests/test_session.py:226:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MagicMock name='send_pong' id='140737316493056'>, name = 'called_with'
def __getattr__(self, name):
if name in {'_mock_methods', '_mock_unsafe'}:
raise AttributeError(name)
elif self._mock_methods is not None:
if name not in self._mock_methods or name in _all_magics:
raise AttributeError("Mock object has no attribute %r" % name)
elif _is_magic(name):
raise AttributeError(name)
if not self._mock_unsafe and (not self._mock_methods or name not in self._mock_methods):
if name.startswith(('assert', 'assret', 'asert', 'aseert', 'assrt')) or name in _ATTRIB_DENY_LIST:
> raise AttributeError(
f"{name!r} is not a valid assertion. Use a spec "
f"for the mock if {name!r} is meant to be an attribute.")
E AttributeError: 'called_with' is not a valid assertion. Use a spec for the mock if 'called_with' is meant to be an attribute.
/nix/store/n3jf1lkdfakxskzsm4nlhss8mdgmcqhc-python3-3.12.2/lib/python3.12/unittest/mock.py:663: AttributeError
Metadata
Metadata
Assignees
Labels
No labels