Azure / Azure/azure-sdk-for-python

Investigate fail a testsuite if any deprecated function is called

Abierto
#38,752 0 comentarios 2 reacciones 1 asignado Reclamado por @laiapat Ver en GitHub
EngSys
Lenguaje dominante
Python
Estrellas
5.6k
Forks
3.4k
Merge medio
2 d 2 h
PR fusionados (30 d)
213

Descripción

In Python, you can tag a function was deprecated using the `warnings` module:
https://docs.python.org/3/library/warnings.html

That's a `DeprecationWarning`.

The goal here, would be to be able to catch those events while running a testsuite and fail the testsuite with a message saying that there are some tests that used deprecated function. Long term, this may help reduce the risk that a new release of a dependency drop a function entirely and we detect it only when it happens.

Possible solutions:
- Investigate if pytest has a plugin already for that
- Redirect warnings to the `py.warnings` logger, see for instance: https://docs.python.org/3/library/logging.html#logging.captureWarnings. This should be possible if we redirect it with a custom handler registered to the `py.warnings` logger, to check in teardown (post-fixture) that the last running test didn't call any deprecation function.

We need a supression mechanism as well, just in case we have no other choice. For instance, if Azure SDK has deprecated functions itself that we test, we should make sure we can test them (deprecated doesn't mean not supported). And there may be situations where the new path proposed by a library is yet too complex and we need to wait a little.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.