taverntesting / tavern

A command-line tool and Python library and Pytest plugin for automated testing of RESTful APIs, with a simple, concise and flexible YAML-based syntax
https://taverntesting.github.io/
MIT License
1.02k stars 192 forks source link

Fix assertion in `TestCheckParseValues::test_warns_bad_type` #894

Closed mgorny closed 9 months ago

mgorny commented 9 months ago

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 commented 9 months ago

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.

mgorny commented 9 months ago

Thanks!