neondatabase / neon

Neon: Serverless Postgres. We separated storage and compute to offer autoscaling, code-like database branching, and scale to zero.
https://neon.tech
Apache License 2.0
15.31k stars 446 forks source link

Improve typing for Python tests #791

Open yeputons opened 3 years ago

yeputons commented 3 years ago

Currently the following checks are disabled for mypy. I think it's worth enabling them back, fixing issues as we go:

Of course, we still have the issue of no type hints for asyncpg (although there is some work-in-progress), cached_property and pytest. I'm wondering how well disallow_untyped_decorators and friends work with ignore_missing_imports for those libraries.

Also:

funbringer commented 3 years ago

Personally, I doubt that we should treat those settings as undisputed setbacks on our road to typechecking everything. There's a concept of gradual typing, which allows one to refine types on demand. Originally, I wanted to enable go-to-definition etc for our fixture code, preserving the ability to omit types in tests themselves. That's why I've relaxed some of the mypy's settings.

One of the reasons we don't write tests in rust is that it's not as forgiving and unsophisticated as python.