[3dprinter-general] Bug#1076871: Bug#1076871: cura: FTBFS: AttributeError: 'called_with' is not a valid assertion. Use a spec for the mock if 'called_with' is meant to be an attribute.

Gregor Riepl onitake at gmail.com
Wed Jul 24 19:59:06 BST 2024


Hi, and thanks for the report.

> [... snipped ...]
> 2:         if not self._mock_unsafe and (not self._mock_methods or name not in self._mock_methods):
> 2:             if name.startswith(('assert', 'assret', 'asert', 'aseert', 'assrt')) or name in _ATTRIB_DENY_LIST:
> 2: >               raise AttributeError(
> 2:                     f"{name!r} is not a valid assertion. Use a spec "
> 2:                     f"for the mock if {name!r} is meant to be an attribute.")
> 2: E               AttributeError: 'called_with' is not a valid assertion. Use a spec for the mock if 'called_with' is meant to be an attribute.

It's caused by incorrect usage of mock.called_with and should actually be mock.assert_called_with, which was flagged in Python 3.12: https://github.com/python/cpython/issues/100690

@hroncok has started working on a patch here: https://github.com/Ultimaker/Cura/pull/16103

I'll try to pick this up and see if it fixes the issue on our side.

Regards,
Gregor



More information about the 3dprinter-general mailing list