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
from typing import List
from typing import Tuple
-import sqlalchemy
from sqlalchemy import testing
from sqlalchemy.testing import config
from sqlalchemy.testing import eq_
yield item
def _cachedir(self):
- sqlalchemy_path = os.path.dirname(os.path.dirname(sqlalchemy.__file__))
-
- # for a pytest from my local ./lib/ , i need mypy_path.
- # for a tox run where sqlalchemy is in site_packages, mypy complains
- # "../python3.10/site-packages is in the MYPYPATH. Please remove it."
- # previously when we used sqlalchemy2-stubs, it would just be
- # installed as a dependency, which is why mypy_path wasn't needed
- # then, but I like to be able to run the test suite from the local
- # ./lib/ as well.
-
- if "site-packages" not in sqlalchemy_path:
- mypy_path = f"mypy_path={sqlalchemy_path}"
- else:
- mypy_path = ""
+ # as of mypy 0.971 i think we need to keep mypy_path empty
+ mypy_path = ""
with tempfile.TemporaryDirectory() as cachedir:
with open(
args.append(path)
- return api.run(args)
+ result = api.run(args)
+ return result
return run
result = mypy_runner(path, use_plugin=use_plugin)
+ not_located = []
+
if expected_messages:
eq_(result[2], 1, msg=result)
):
break
else:
+ not_located.append(msg)
continue
del output[idx]
+ if not_located:
+ print(f"Couldn't locate expected messages: {not_located}")
+ print("\n".join(msg for _, msg in output))
+ assert False, "expected messages not found, see stdout"
+
if output:
print(f"{len(output)} messages from mypy were not consumed:")
print("\n".join(msg for _, msg in output))