]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
remove mypy_path workaround and ensure messages received
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 23 Jul 2022 14:18:06 +0000 (10:18 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 23 Jul 2022 16:18:22 +0000 (12:18 -0400)
Fixes: #8281
Change-Id: Ice47880ba7924daff68aef6b1791f3c66849f550
(cherry picked from commit 4fe222d9412df30fc15ace3d7a7fd4365eb9e05a)

test/ext/mypy/files/relationship_err3.py
test/ext/mypy/files/typing_err3.py
test/ext/mypy/test_mypy_plugin_py3k.py

index aa76ae1f0e0cc749c1011dc63c577477011c3fe0..1c7cd9f303d48f3c01d5649891af0e2dce214732 100644 (file)
@@ -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
index 5383f89560cf6838dcf3a1205750614e9bcafca9..3fd1f86ff60530e435b1c63c6518c4cb45f3a934 100644 (file)
@@ -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"
     )
index 5a6a29727323430646ed04e0b807c101f395ea5c..181a7958f3f3640930fa2fbc76f78b047272940f 100644 (file)
@@ -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: