[3dprinter-general] 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.

Santiago Vila sanvila at debian.org
Wed Jul 24 11:45:27 BST 2024


Package: src:cura
Version: 5.0.0-3
Severity: serious
Tags: ftbfs

Dear maintainer:

During a rebuild of all packages in unstable, your package failed to build:

--------------------------------------------------------------------------------
[...]
  debian/rules build
dh build --buildsystem=cmake --with python3
    dh_update_autotools_config -O--buildsystem=cmake
    dh_autoreconf -O--buildsystem=cmake
    debian/rules override_dh_auto_configure
make[1]: Entering directory '/<<PKGBUILDDIR>>'
dh_auto_configure -- -DURANIUM_DIR=/usr/share/uranium -DCURA_VERSION=5.0.0 \
	-DPython_VERSION=3.12
	cd obj-x86_64-linux-gnu && DEB_PYTHON_INSTALL_LAYOUT=deb cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_INSTALL_LOCALSTATEDIR=/var -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON -DFETCHCONTENT_FULLY_DISCONNECTED=ON -DCMAKE_INSTALL_RUNSTATEDIR=/run "-GUnix Makefiles" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu -DURANIUM_DIR=/usr/share/uranium -DCURA_VERSION=5.0.0 -DPython_VERSION=3.12 ..
CMake Warning (dev) at CMakeLists.txt:4 (project):
   cmake_minimum_required() should be called prior to this top-level project()
   call.  Please see the cmake-commands(7) manual for usage documentation of
   both commands.
This warning is for project developers.  Use -Wno-dev to suppress it.

[... snipped ...]

2:             authorization_service.refreshAccessToken()
2: >           assert authorization_service.onAuthStateChanged.emit.called_with(True)
2:
2: ../tests/TestOAuth2.py:84:
2: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2:
2: self = <MagicMock id='140633923410000'>, name = 'called_with'
2:
2:     def __getattr__(self, name):
2:         if name in {'_mock_methods', '_mock_unsafe'}:
2:             raise AttributeError(name)
2:         elif self._mock_methods is not None:
2:             if name not in self._mock_methods or name in _all_magics:
2:                 raise AttributeError("Mock object has no attribute %r" % name)
2:         elif _is_magic(name):
2:             raise AttributeError(name)
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.
2:
2: /usr/lib/python3.12/unittest/mock.py:663: AttributeError
2: ----------------------------- Captured stdout call -----------------------------
2: [MainThread] cura.OAuth2.AuthorizationService._storeAuthData [289]: Attempting to store the auth data for [https://account.ultimaker.com]
2: ________________________ test_refreshAccessTokenFailed _________________________
2:
2:     def test_refreshAccessTokenFailed():
2:         """
2:         Test if the authentication is reset once the refresh token fails to refresh access.
2:         """
2:         authorization_service = AuthorizationService(OAUTH_SETTINGS, Preferences())
2:         authorization_service.initialize()
2:
2:         def mock_refresh(self, refresh_token, callback):  # Refreshing gives a valid token.
2:             callback(FAILED_AUTH_RESPONSE)
2:         mock_reply = Mock()  # The response that the request should give, containing an error about it failing to authenticate.
2:         mock_reply.error = Mock(return_value = QNetworkReply.NetworkError.AuthenticationRequiredError)  # The reply is 403: Authentication required, meaning the server responded with a "Can't do that, Dave".
2:         http_mock = Mock()
2:         http_mock.get = lambda url, headers_dict, callback, error_callback: callback(mock_reply)
2:         http_mock.post = lambda url, data, headers_dict, callback, error_callback: callback(mock_reply)
2:
2:         with patch("UM.TaskManagement.HttpRequestManager.HttpRequestManager.readJSON", Mock(return_value = {"error_description": "Mock a failed request!"})):
2:             with patch("UM.TaskManagement.HttpRequestManager.HttpRequestManager.getInstance", MagicMock(return_value = http_mock)):
2:                 authorization_service._storeAuthData(SUCCESSFUL_AUTH_RESPONSE)
2:                 authorization_service.onAuthStateChanged.emit = MagicMock()
2:                 with patch("cura.OAuth2.AuthorizationHelpers.AuthorizationHelpers.getAccessTokenUsingRefreshToken", mock_refresh):
2:                     authorization_service.refreshAccessToken()
2: >                   assert authorization_service.onAuthStateChanged.emit.called_with(False)
2:
2: ../tests/TestOAuth2.py:193:
2: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2:
2: self = <MagicMock id='140633924052480'>, name = 'called_with'
2:
2:     def __getattr__(self, name):
2:         if name in {'_mock_methods', '_mock_unsafe'}:
2:             raise AttributeError(name)
2:         elif self._mock_methods is not None:
2:             if name not in self._mock_methods or name in _all_magics:
2:                 raise AttributeError("Mock object has no attribute %r" % name)
2:         elif _is_magic(name):
2:             raise AttributeError(name)
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.
2:
2: /usr/lib/python3.12/unittest/mock.py:663: AttributeError
2: ----------------------------- Captured stdout call -----------------------------
2: [MainThread] cura.OAuth2.AuthorizationService._storeAuthData [289]: Attempting to store the auth data for [https://account.ultimaker.com]
2: [MainThread] cura.OAuth2.AuthorizationHelpers.checkToken [115]: Checking the access token for [https://account.ultimaker.com/check-token]
2: [MainThread] cura.OAuth2.AuthorizationHelpers._parseUserProfile [136]: Could not access account information. QNetworkError <Mock name='mock.errorString()' id='140633924052096'>
2: [MainThread] cura.OAuth2.AuthorizationHelpers.getAccessTokenUsingRefreshToken [64]: Refreshing the access token for [https://account.ultimaker.com]
2: [MainThread] cura.OAuth2.AuthorizationService.process_auth_data [127]: Unable to use the refresh token to get a new access token.
2: [MainThread] cura.OAuth2.AuthorizationService.store_profile [90]: The user profile could not be loaded. The user must log in again!
2: [MainThread] cura.OAuth2.AuthorizationService._storeAuthData [289]: Attempting to store the auth data for [https://account.ultimaker.com]
2: [MainThread] cura.OAuth2.AuthorizationService._storeAuthData [300]: Clearing the user profile
2: [MainThread] cura.OAuth2.AuthorizationService.refreshAccessToken [162]: Unable to refresh access token, since there is no refresh token.
2: =============================== warnings summary ===============================
2: ../../../../usr/lib/python3/dist-packages/UM/Settings/SettingFunction.py:230
2:   /usr/lib/python3/dist-packages/UM/Settings/SettingFunction.py:230: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
2:     def visit_Str(self, node: ast.Str) -> None:
2:
2: ../cura/UI/ObjectsModel.py:72
2:   /<<PKGBUILDDIR>>/cura/UI/ObjectsModel.py:72: SyntaxWarning: invalid escape sequence '\('
2:     self._naming_regex = re.compile("^(.+)\(([0-9]+)\)$")
2:
2: ../../../../usr/lib/python3/dist-packages/UM/Settings/SettingFunction.py:263: 567 warnings
2:   /usr/lib/python3/dist-packages/UM/Settings/SettingFunction.py:263: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
2:     if node.s.startswith("_"):
2:
2: -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
2: - generated xml file: /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/junit-pytest-main.xml -
2: =========================== short test summary info ============================
2: FAILED ../tests/API/TestAccount.py::test_errorLoginState - AttributeError: 'c...
2: FAILED ../tests/Settings/TestCuraStackBuilder.py::test_createMachineWithUnknownDefinition
2: FAILED ../tests/TestOAuth2.py::test_refreshAccessTokenSuccess - AttributeErro...
2: FAILED ../tests/TestOAuth2.py::test_refreshAccessTokenFailed - AttributeError...
2: =========== 4 failed, 9230 passed, 2 skipped, 569 warnings in 10.16s ===========
14/14 Test  #2: pytest-main ......................***Failed   11.49 sec
============================= test session starts ==============================
platform linux -- Python 3.12.4, pytest-8.2.2, pluggy-1.5.0
rootdir: /<<PKGBUILDDIR>>
configfile: pytest.ini
collected 9236 items

../tests/API/TestAccount.py ...F..                                       [  0%]
../tests/Machines/Models/TestDiscoveredCloudPrintersModel.py .           [  0%]
../tests/Machines/Models/TestDiscoveredPrintersModel.py s...             [  0%]
../tests/Machines/TestContainerTree.py .....                             [  0%]
../tests/Machines/TestMachineNode.py ....                                [  0%]
../tests/Machines/TestMaterialNode.py ......                             [  0%]
../tests/Machines/TestPlatformMeshes.py ................................ [  0%]
........................................................................ [  1%]
........................................................................ [  2%]
......                                                                   [  2%]
../tests/Machines/TestQualityNode.py .                                   [  2%]
../tests/Machines/TestVariantNode.py ................                    [  2%]
../tests/PrinterOutput/Models/TestPrintJobOutputModel.py .........       [  2%]
../tests/PrinterOutput/Models/TestPrinterConfigurationModel.py ...       [  2%]
../tests/PrinterOutput/Models/TestPrinterOutputModel.py ................ [  2%]
.                                                                        [  2%]
../tests/PrinterOutput/TestNetworkedPrinterOutputDevice.py .......       [  2%]
../tests/PrinterOutput/TestPrinterOutputDevice.py ....                   [  2%]
../tests/Settings/TestContainerManager.py .......                        [  2%]
../tests/Settings/TestCuraContainerRegistry.py .....................s... [  3%]
..                                                                       [  3%]
../tests/Settings/TestCuraStackBuilder.py F..                            [  3%]
../tests/Settings/TestExtruderStack.py ................................. [  3%]
....................                                                     [  3%]
../tests/Settings/TestGlobalStack.py ................................... [  4%]
.......................                                                  [  4%]
../tests/Settings/TestProfiles.py ...................................... [  4%]
........................................................................ [  5%]
........................................................................ [  6%]
........................................................................ [  7%]
........................................................................ [  8%]
........................................................................ [  8%]
........................................................................ [  9%]
........................................................................ [ 10%]
........................................................................ [ 11%]
........................................................................ [ 11%]
........................................................................ [ 12%]
........................................................................ [ 13%]
........................................................................ [ 14%]
........................................................................ [ 15%]
........................................................................ [ 15%]
........................................................................ [ 16%]
........................................................................ [ 17%]
........................................................................ [ 18%]
........................................................................ [ 18%]
........................................................................ [ 19%]
........................................................................ [ 20%]
........................................................................ [ 21%]
........................................................................ [ 22%]
........................................................................ [ 22%]
........................................................................ [ 23%]
........................................................................ [ 24%]
........................................................................ [ 25%]
........................................................................ [ 25%]
........................................................................ [ 26%]
........................................................................ [ 27%]
........................................................................ [ 28%]
........................................................................ [ 29%]
........................................................................ [ 29%]
........................................................................ [ 30%]
........................................................................ [ 31%]
........................................................................ [ 32%]
........................................................................ [ 32%]
........................................................................ [ 33%]
........................................................................ [ 34%]
........................................................................ [ 35%]
........................................................................ [ 36%]
........................................................................ [ 36%]
........................................................................ [ 37%]
........................................................................ [ 38%]
........................................................................ [ 39%]
........................................................................ [ 39%]
........................................................................ [ 40%]
........................................................................ [ 41%]
........................................................................ [ 42%]
........................................................................ [ 43%]
........................................................................ [ 43%]
........................................................................ [ 44%]
........................................................................ [ 45%]
........................................................................ [ 46%]
........................................................................ [ 46%]
........................................................................ [ 47%]
........................................................................ [ 48%]
........................................................................ [ 49%]
........................................................................ [ 50%]
........................................................................ [ 50%]
........................................................................ [ 51%]
........................................................................ [ 52%]
........................................................................ [ 53%]
........................................................................ [ 53%]
........................................................................ [ 54%]
........................................................................ [ 55%]
........................................................................ [ 56%]
........................................................................ [ 57%]
........................................................................ [ 57%]
........................................................................ [ 58%]
........................................................................ [ 59%]
........................................................................ [ 60%]
........................................................................ [ 61%]
........................................................................ [ 61%]
........................................................................ [ 62%]
........................................................................ [ 63%]
........................................................................ [ 64%]
........................................................................ [ 64%]
........................................................................ [ 65%]
........................................................................ [ 66%]
........................................................................ [ 67%]
........................................................................ [ 68%]
........................................................................ [ 68%]
........................................................................ [ 69%]
........................................................................ [ 70%]
........................................................................ [ 71%]
........................................................................ [ 71%]
........................................................................ [ 72%]
........................................................................ [ 73%]
........................................................................ [ 74%]
........................................................................ [ 75%]
........................................................................ [ 75%]
........................................................................ [ 76%]
........................................................................ [ 77%]
........................................................................ [ 78%]
........................................................................ [ 78%]
........................................................................ [ 79%]
........................................................................ [ 80%]
........................................................................ [ 81%]
........................................................................ [ 82%]
........................................................................ [ 82%]
........................................................................ [ 83%]
........................................................................ [ 84%]
........................................................................ [ 85%]
........................................................................ [ 85%]
........................................................................ [ 86%]
........................................................................ [ 87%]
........................................................................ [ 88%]
........................................................................ [ 89%]
........................................................................ [ 89%]
........................................................................ [ 90%]
........................................................................ [ 91%]
........................................................................ [ 92%]
........................................................................ [ 92%]
........................................................................ [ 93%]
........................................................................ [ 94%]
........................................................................ [ 95%]
........................................................................ [ 96%]
........................................................................ [ 96%]
........................................................................ [ 97%]
.........................................                                [ 98%]
../tests/Settings/TestSettingInheritanceManager.py .............         [ 98%]
../tests/Settings/TestSettingOverrideDecorator.py ...                    [ 98%]
../tests/Settings/TestSettingVisibilityPresets.py ....                   [ 98%]
../tests/TestBuildVolume.py ....................................         [ 98%]
../tests/TestConvexHullDecorator.py .............................        [ 99%]
../tests/TestCuraSceneController.py ....                                 [ 99%]
../tests/TestCuraSceneNode.py .....                                      [ 99%]
../tests/TestExtruderManager.py .                                        [ 99%]
../tests/TestGCodeListDecorator.py ..                                    [ 99%]
../tests/TestIntentManager.py ....                                       [ 99%]
../tests/TestLayer.py ....                                               [ 99%]
../tests/TestMachineAction.py ...                                        [ 99%]
../tests/TestMachineManager.py ........................                  [ 99%]
../tests/TestOAuth2.py .F....F.......                                    [ 99%]
../tests/TestObjectsModel.py .................                           [ 99%]
../tests/TestPrintInformation.py ....                                    [ 99%]
../tests/TestProfileRequirements.py .....                                [ 99%]
../tests/TestThemes.py ....                                              [100%]

=================================== FAILURES ===================================
_____________________________ test_errorLoginState _____________________________

application = <MagicMock name='getInstance' id='140633969739680'>

     @patch("UM.Application.Application.getInstance")
     def test_errorLoginState(application):
         account = Account(MagicMock())
         mocked_auth_service = MagicMock()
         account._authorization_service = mocked_auth_service
         account.loginStateChanged = MagicMock()
     
         account._onLoginStateChanged(True, "BLARG!")
         # Even though we said that the login worked, it had an error message, so the login failed.
>       account.loginStateChanged.emit.called_with(False)

../tests/API/TestAccount.py:77:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <MagicMock name='mock.emit' id='140633969803232'>, 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.

/usr/lib/python3.12/unittest/mock.py:663: AttributeError
----------------------------- Captured stdout call -----------------------------
[MainThread] cura.API.Account._onLoginStateChanged [188]: Failed to login: BLARG!
___________________ test_createMachineWithUnknownDefinition ____________________

application = <MagicMock id='140633967356448'>
container_registry = <cura.Settings.CuraContainerRegistry.CuraContainerRegistry object at 0x7fe7e5aaf980>

     def test_createMachineWithUnknownDefinition(application, container_registry):
         application.getContainerRegistry = MagicMock(return_value=container_registry)
         with patch("cura.CuraApplication.CuraApplication.getInstance", MagicMock(return_value=application)):
             with patch("UM.ConfigurationErrorMessage.ConfigurationErrorMessage.getInstance") as mocked_config_error:
                 assert CuraStackBuilder.createMachine("Whatever", "NOPE") is None
>               assert mocked_config_error.addFaultyContainers.called_with("NOPE")

../tests/Settings/TestCuraStackBuilder.py:55:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <MagicMock name='getInstance.addFaultyContainers' id='140633967380864'>
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.

/usr/lib/python3.12/unittest/mock.py:663: AttributeError
----------------------------- Captured stdout call -----------------------------
[MainThread] cura.Settings.CuraStackBuilder.createMachine [39]: Definition NOPE was not found!
________________________ test_refreshAccessTokenSuccess ________________________

     def test_refreshAccessTokenSuccess():
         authorization_service = AuthorizationService(OAUTH_SETTINGS, Preferences())
         authorization_service.initialize()
         with patch.object(AuthorizationService, "getUserProfile", return_value=UserProfile()):
             authorization_service._storeAuthData(SUCCESSFUL_AUTH_RESPONSE)
         authorization_service.onAuthStateChanged.emit = MagicMock()
     
         with patch.object(AuthorizationHelpers, "getAccessTokenUsingRefreshToken", return_value=SUCCESSFUL_AUTH_RESPONSE):
             authorization_service.refreshAccessToken()
>           assert authorization_service.onAuthStateChanged.emit.called_with(True)

../tests/TestOAuth2.py:84:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <MagicMock id='140633923410000'>, 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.

/usr/lib/python3.12/unittest/mock.py:663: AttributeError
----------------------------- Captured stdout call -----------------------------
[MainThread] cura.OAuth2.AuthorizationService._storeAuthData [289]: Attempting to store the auth data for [https://account.ultimaker.com]
________________________ test_refreshAccessTokenFailed _________________________

     def test_refreshAccessTokenFailed():
         """
         Test if the authentication is reset once the refresh token fails to refresh access.
         """
         authorization_service = AuthorizationService(OAUTH_SETTINGS, Preferences())
         authorization_service.initialize()
     
         def mock_refresh(self, refresh_token, callback):  # Refreshing gives a valid token.
             callback(FAILED_AUTH_RESPONSE)
         mock_reply = Mock()  # The response that the request should give, containing an error about it failing to authenticate.
         mock_reply.error = Mock(return_value = QNetworkReply.NetworkError.AuthenticationRequiredError)  # The reply is 403: Authentication required, meaning the server responded with a "Can't do that, Dave".
         http_mock = Mock()
         http_mock.get = lambda url, headers_dict, callback, error_callback: callback(mock_reply)
         http_mock.post = lambda url, data, headers_dict, callback, error_callback: callback(mock_reply)
     
         with patch("UM.TaskManagement.HttpRequestManager.HttpRequestManager.readJSON", Mock(return_value = {"error_description": "Mock a failed request!"})):
             with patch("UM.TaskManagement.HttpRequestManager.HttpRequestManager.getInstance", MagicMock(return_value = http_mock)):
                 authorization_service._storeAuthData(SUCCESSFUL_AUTH_RESPONSE)
                 authorization_service.onAuthStateChanged.emit = MagicMock()
                 with patch("cura.OAuth2.AuthorizationHelpers.AuthorizationHelpers.getAccessTokenUsingRefreshToken", mock_refresh):
                     authorization_service.refreshAccessToken()
>                   assert authorization_service.onAuthStateChanged.emit.called_with(False)

../tests/TestOAuth2.py:193:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <MagicMock id='140633924052480'>, 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.

/usr/lib/python3.12/unittest/mock.py:663: AttributeError
----------------------------- Captured stdout call -----------------------------
[MainThread] cura.OAuth2.AuthorizationService._storeAuthData [289]: Attempting to store the auth data for [https://account.ultimaker.com]
[MainThread] cura.OAuth2.AuthorizationHelpers.checkToken [115]: Checking the access token for [https://account.ultimaker.com/check-token]
[MainThread] cura.OAuth2.AuthorizationHelpers._parseUserProfile [136]: Could not access account information. QNetworkError <Mock name='mock.errorString()' id='140633924052096'>
[MainThread] cura.OAuth2.AuthorizationHelpers.getAccessTokenUsingRefreshToken [64]: Refreshing the access token for [https://account.ultimaker.com]
[MainThread] cura.OAuth2.AuthorizationService.process_auth_data [127]: Unable to use the refresh token to get a new access token.
[MainThread] cura.OAuth2.AuthorizationService.store_profile [90]: The user profile could not be loaded. The user must log in again!
[MainThread] cura.OAuth2.AuthorizationService._storeAuthData [289]: Attempting to store the auth data for [https://account.ultimaker.com]
[MainThread] cura.OAuth2.AuthorizationService._storeAuthData [300]: Clearing the user profile
[MainThread] cura.OAuth2.AuthorizationService.refreshAccessToken [162]: Unable to refresh access token, since there is no refresh token.
=============================== warnings summary ===============================
../../../../usr/lib/python3/dist-packages/UM/Settings/SettingFunction.py:230
   /usr/lib/python3/dist-packages/UM/Settings/SettingFunction.py:230: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
     def visit_Str(self, node: ast.Str) -> None:

../cura/UI/ObjectsModel.py:72
   /<<PKGBUILDDIR>>/cura/UI/ObjectsModel.py:72: SyntaxWarning: invalid escape sequence '\('
     self._naming_regex = re.compile("^(.+)\(([0-9]+)\)$")

../../../../usr/lib/python3/dist-packages/UM/Settings/SettingFunction.py:263: 567 warnings
   /usr/lib/python3/dist-packages/UM/Settings/SettingFunction.py:263: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
     if node.s.startswith("_"):

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
- generated xml file: /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/junit-pytest-main.xml -
=========================== short test summary info ============================
FAILED ../tests/API/TestAccount.py::test_errorLoginState - AttributeError: 'c...
FAILED ../tests/Settings/TestCuraStackBuilder.py::test_createMachineWithUnknownDefinition
FAILED ../tests/TestOAuth2.py::test_refreshAccessTokenSuccess - AttributeErro...
FAILED ../tests/TestOAuth2.py::test_refreshAccessTokenFailed - AttributeError...
=========== 4 failed, 9230 passed, 2 skipped, 569 warnings in 10.16s ===========


93% tests passed, 1 tests failed out of 14

Total Test time (real) =  11.50 sec

The following tests FAILED:
	  2 - pytest-main (Failed)
Errors while running CTest
make[2]: *** [Makefile:74: test] Error 8
make[2]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
dh_auto_test: error: cd obj-x86_64-linux-gnu && make -j2 test ARGS\+=--verbose ARGS\+=-j2 returned exit code 2
make[1]: *** [debian/rules:24: override_dh_auto_test] Error 25
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
make: *** [debian/rules:10: build] Error 2
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2
--------------------------------------------------------------------------------

The above is just how the build ends and not necessarily the most relevant part.
If required, the full build log is available here:

https://people.debian.org/~sanvila/build-logs/202407/

About the archive rebuild: The build was made on virtual machines
of type m6a.large and r6a.large from AWS, using sbuild and a
reduced chroot with only build-essential packages.

If you could not reproduce the bug please contact me privately, as I
am willing to provide ssh access to a virtual machine where the bug is
fully reproducible.

If this is really a bug in one of the build-depends, please use
reassign and affects, so that this is still visible in the BTS web
page for this package.

Thanks.



More information about the 3dprinter-general mailing list