Prevent unexpected warnings in the code base
Body
Spun out of https://github.com/apache/airflow/pull/19725#issuecomment-977062213
It may be worthwhile to strengthen up the test suite to also catch warnings so we can fix them before the reach the user. Currently there are a ton of warnings being emitted from the test suite, and it’s not exactly optimal (and makes the Pytest result yellow instead of green). Pytest has a flag for “strict mode”.
I’m thinking maybe we can add a CI job to enable that, and slowly fix those warnings (either by actually rewriting relevant code, or just add suppression when they are expected). Once they are all delt with, we can enable them globally on all jobs (and remove the redundant job).
Committer
- [X] I acknowledge that I am a maintainer/committer of the Apache Airflow project.
Yep. Good idea. For now we only have it at the "import level" in providers for deprecation warnings - i.e. all classes from providers are tested if they are not geneating any warning simply by importing them (except the known ones) https://github.com/apache/airflow/blob/d58df468c8d77c5d45e80f2333eb074bb7771a95/dev/provider_packages/prepare_provider_packages.py#L2070 - but indeed, being strict on warnings at the unit tests is good goal (will take some time thought)
Do we still need this task? From what i've seen the CI does catch unexpected warnings.
I thint it would be worthwhile. Currently we only show warnings produced at "airflow" module" but we might want to get rid of all of them.