From: Mike Bayer Date: Sat, 23 Jul 2022 14:18:06 +0000 (-0400) Subject: remove mypy_path workaround and ensure messages received X-Git-Tag: rel_1_4_40~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c9d88d546829f6aca48fb421c1484f25828160a;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git remove mypy_path workaround and ensure messages received Fixes: #8281 Change-Id: Ice47880ba7924daff68aef6b1791f3c66849f550 (cherry picked from commit 4fe222d9412df30fc15ace3d7a7fd4365eb9e05a) --- diff --git a/test/ext/mypy/files/relationship_err3.py b/test/ext/mypy/files/relationship_err3.py index aa76ae1f0e..1c7cd9f303 100644 --- a/test/ext/mypy/files/relationship_err3.py +++ b/test/ext/mypy/files/relationship_err3.py @@ -24,7 +24,7 @@ class A(Base): id = Column(Integer, primary_key=True) data = Column(String) - # EXPECTED: Left hand assignment 'bs: "Set[B]"' not compatible with ORM mapped expression of type "Mapped[List[B]]" # noqa + bs: Set[B] = relationship(B, uselist=True, back_populates="a") # EXPECTED: Left hand assignment 'another_bs: "Set[B]"' not compatible with ORM mapped expression of type "Mapped[B]" # noqa diff --git a/test/ext/mypy/files/typing_err3.py b/test/ext/mypy/files/typing_err3.py index 5383f89560..3fd1f86ff6 100644 --- a/test/ext/mypy/files/typing_err3.py +++ b/test/ext/mypy/files/typing_err3.py @@ -22,7 +22,6 @@ class User(Base): id = Column(Integer, primary_key=True) - # EXPECTED_MYPY: Unexpected keyword argument "wrong_arg" for "RelationshipProperty" # noqa addresses: Mapped[List["Address"]] = relationship( "Address", wrong_arg="imwrong" ) diff --git a/test/ext/mypy/test_mypy_plugin_py3k.py b/test/ext/mypy/test_mypy_plugin_py3k.py index 5a6a297273..181a7958f3 100644 --- a/test/ext/mypy/test_mypy_plugin_py3k.py +++ b/test/ext/mypy/test_mypy_plugin_py3k.py @@ -65,7 +65,8 @@ class MypyPluginTest(fixtures.TestBase): args.append(path) - return api.run(args) + result = api.run(args) + return result return run @@ -181,6 +182,8 @@ class MypyPluginTest(fixtures.TestBase): result = mypy_runner(path, use_plugin=use_plugin) + not_located = [] + if expected_errors: eq_(result[2], 1, msg=result) @@ -201,9 +204,14 @@ class MypyPluginTest(fixtures.TestBase): ): break else: + not_located.append(msg) continue del errors[idx] + if not_located: + print(f"Couldn't locate expected messages: {not_located}") + assert False, "expected messages not found, see stdout" + assert not errors, "errors remain: %s" % "\n".join(errors) else: