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 assertion in TestCheckParseValues::test_warns_bad_type #894

Merged
merged 2 commits into from
Nov 19, 2023

Conversation

mgorny
Copy link
Contributor

@mgorny mgorny commented Nov 19, 2023

Fix the assertion in TestCheckParseValues::test_warns_bad_type to use .assert_called_with() rather than non-existing .called_with() method. The latter is wrongly interpreted as calling a mocked method in Python < 3.12, and therefore does not test anything at all. Starting with Python 3.12, it results in an error:

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

Fixing the call also revealed that the assertion was incorrect, so I've updated it to match the current call.

Fix the assertion in TestCheckParseValues::test_warns_bad_type
to use `.assert_called_with()` rather than non-existing `.called_with()`
method.  The latter is wrongly interpreted as calling a mocked method
in Python < 3.12, and therefore does not test anything at all.  Starting
with Python 3.12, it results in an error:

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

Fixing the call also revealed that the assertion was incorrect, so I've
updated it to match the current call.
@mgorny
Copy link
Contributor Author

mgorny commented Nov 19, 2023

I've seen that failure with tox too. However, the tests pass with the newest versions of dependencies. I think the pins are outdated/incompatible with one another.

@michaelboulton michaelboulton merged commit d0b0fa6 into taverntesting:master Nov 19, 2023
7 checks passed
@mgorny
Copy link
Contributor Author

mgorny commented Nov 19, 2023

Thanks!

@mgorny mgorny deleted the test-assert branch November 19, 2023 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants