There seems to be a regression in pytest version 7.3.x when a walrus operator is used in an assert line.
Code:
import json
import pytest
def test_json_encoder():
assert (object:="foo") in json.dumps(object)
Fails the test with error:
UnboundLocalError: cannot access local variable 'object' where it is not associated with a value
in pytest version 7.3.x, whereas with pytest version 7.2.x it passes successfully. My Python version is 3.11.
Looks like it has to do with PR #10758.
There seems to be a regression in pytest version
7.3.xwhen a walrus operator is used in an assert line.Code:
Fails the test with error:
in pytest version
7.3.x, whereas with pytest version7.2.xit passes successfully. My Python version is3.11.Looks like it has to do with PR #10758.