pyproject.toml: tweak pyright config

Unfortunately, `root=` doesn't mean what I thought it did.  It does
select the files to be considered for the given overrides, but it also
adds the given directory to the search path.

Having `root="test"` is a problem because it contains a `pytest`
subdirectory, which is what pyright thinks you're talking about if you
say `import pytest`.

Ideally we'd be able to say that all code found in `test/` gets access
to testlib, without adding `test/` itself.  I also tried to say that
`src/` doesn't get access to testlib but `.` does, but this resulted in
`testlib` being accessible from files in `src/` as well.

Let's just simplify this to be more like our mypy setup.  Really: if
you're importing testlib from the bridge, you're gonna find out about
the problem with that pretty quickly anyway.

Let's turn on strict while we're at it.  We don't actually run pyright,
but it gets more messages into the editor, which is nice.
This commit is contained in:
Allison Karlitskaya 2024-08-15 14:18:25 +02:00 committed by Martin Pitt
parent 653829e423
commit 2c11e25896

View file

@ -144,10 +144,8 @@ log_cli = true
required_plugins = ["pytest-asyncio"]
[tool.pyright]
executionEnvironments = [
{ root = "test", extraPaths = ["test/common", "bots"] },
{ root = "src" }
]
strict = ["**"]
extraPaths = ["src", "test/common", "bots"]
[tool.vulture]
paths = [