From 5012474287049a8b48bff24555e980619434b874 Mon Sep 17 00:00:00 2001 From: Yuchen Jin Date: Tue, 26 Mar 2024 13:15:44 -0500 Subject: [PATCH] Fix an issue when `tox p` fails because `mypy` is forbidden. See details here: https://stackoverflow.com/questions/47642747/tox-warningtest-command-found-but-not-installed-in-testenv --- src/flask_sqlalchemy/extension.py | 8 ++------ tox.ini | 2 ++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/flask_sqlalchemy/extension.py b/src/flask_sqlalchemy/extension.py index 1cc2af87..4645f159 100644 --- a/src/flask_sqlalchemy/extension.py +++ b/src/flask_sqlalchemy/extension.py @@ -952,9 +952,7 @@ def _set_rel_query(self, kwargs: dict[str, t.Any]) -> None: backref[1].setdefault("query_class", self.Query) - def relationship( - self, *args: t.Any, **kwargs: t.Any - ) -> sa_orm.Relationship[t.Any]: + def relationship(self, *args: t.Any, **kwargs: t.Any) -> sa_orm.Relationship[t.Any]: """A :func:`sqlalchemy.orm.relationship` that applies this extension's :attr:`Query` class for dynamic relationships and backrefs. @@ -976,9 +974,7 @@ def dynamic_loader( self._set_rel_query(kwargs) return sa_orm.dynamic_loader(argument, **kwargs) - def _relation( - self, *args: t.Any, **kwargs: t.Any - ) -> sa_orm.Relationship[t.Any]: + def _relation(self, *args: t.Any, **kwargs: t.Any) -> sa_orm.Relationship[t.Any]: """A :func:`sqlalchemy.orm.relationship` that applies this extension's :attr:`Query` class for dynamic relationships and backrefs. diff --git a/tox.ini b/tox.ini index 7085991f..9a21a023 100644 --- a/tox.ini +++ b/tox.ini @@ -20,11 +20,13 @@ deps = commands = pytest -v --tb=short --basetemp={envtmpdir} {posargs} [testenv:style] +allowlist_externals = mypy deps = pre-commit skip_install = true commands = pre-commit run --all-files [testenv:typing] +allowlist_externals = mypy deps = -r requirements/mypy.txt commands = mypy --python-version 3.8