diff --git a/changelog.d/731.downstream.rst b/changelog.d/731.downstream.rst new file mode 100644 index 00000000..3b19d48e --- /dev/null +++ b/changelog.d/731.downstream.rst @@ -0,0 +1 @@ +Added pyright type-checking. diff --git a/pytest_asyncio/plugin.py b/pytest_asyncio/plugin.py index 9bfcfc64..5955bb0a 100644 --- a/pytest_asyncio/plugin.py +++ b/pytest_asyncio/plugin.py @@ -392,6 +392,7 @@ def _from_function(cls, function: Function, /) -> Function: Function item. """ assert function.get_closest_marker("asyncio") + assert function.parent is not None subclass_instance = cls.from_parent( function.parent, name=function.name, diff --git a/tox.ini b/tox.ini index e6457f56..3608cc56 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 4.9.0 -envlist = py39, py310, py311, py312, py313, py314, pytest-min, docs +envlist = py39, py310, py311, py312, py313, py314, pytest-min, docs, pyright isolated_build = true passenv = CI @@ -69,12 +69,19 @@ passenv = SSH_AUTH_SOCK skip_install = false +[testenv:pyright] +deps = + pyright[nodejs] + pytest +commands = pyright pytest_asyncio/ +skip_install = true + [gh-actions] python = 3.9: py39, pytest-min 3.10: py310 3.11: py311 3.12: py312 - 3.13: py313 + 3.13: py313, pyright 3.14-dev: py314 pypy3: pypy3