Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix asserts for called once in Python 3.12 #16103

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hroncok
Copy link
Contributor

@hroncok hroncok commented Jul 10, 2023

Description

This fixes:

    E               AttributeError: 'called_with' is not a valid assertion. Use a spec for the mock if 'called_with' is meant to be an attribute.

    FAILED tests/TestOAuth2.py::test_refreshAccessTokenSuccess - AttributeError: ...
    FAILED tests/TestOAuth2.py::test_refreshAccessTokenFailed - AttributeError: '...
    FAILED tests/API/TestAccount.py::test_errorLoginState - AttributeError: 'call...
    FAILED tests/Settings/TestCuraStackBuilder.py::test_createMachineWithUnknownDefinition

Unfortunately, some assertions failed when the invocation was fixed. Hecen a draft.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Printer definition file(s)
  • Translations

How Has This Been Tested?

  • I built the package in Fedora 39 with Python 3.12.0b3

Test Configuration:

  • Operating System: Fedora 39

Checklist:

hroncok added 2 commits July 11, 2023 00:03
    E               AttributeError: 'called_with' is not a valid assertion. Use a spec for the mock if 'called_with' is meant to be an attribute.

    FAILED tests/TestOAuth2.py::test_refreshAccessTokenSuccess - AttributeError: ...
    FAILED tests/TestOAuth2.py::test_refreshAccessTokenFailed - AttributeError: '...
    FAILED tests/API/TestAccount.py::test_errorLoginState - AttributeError: 'call...
    FAILED tests/Settings/TestCuraStackBuilder.py::test_createMachineWithUnknownDefinition
@github-actions github-actions bot added the PR: Community Contribution 👑 Community Contribution PR's label Jul 10, 2023
@casperlamboo casperlamboo added the PR: BooBoos 😇 Suggestions for Typos, like the NoMesh or there is a suggested refactor label Feb 16, 2024
@onitake
Copy link
Contributor

onitake commented Jul 30, 2024

Thanks for taking the time to fix these issues, @hroncok .
We ran into the same issues in Debian, and I took the liberty to add them to our patch list. I hope that's ok.

Regarding the failing tests: By the nature of the issue, it looks like these unit tests never worked correctly, they were just silently ignored thanks to the incorrect usage of called_with. See python/cpython#100690 for more info on this change in Python 3.12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: BooBoos 😇 Suggestions for Typos, like the NoMesh or there is a suggested refactor PR: Community Contribution 👑 Community Contribution PR's
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants