graphql-python / graphql-python/graphene

Allow for curbing logs while testing

Abierto
#1,241 0 comentarios 8 reacciones 0 asignados Ver en GitHub
✨ enhancement
Lenguaje dominante
Python
Estrellas
8.2k
Forks
818
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

**Is your feature request related to a problem? Please describe.**
Yes, I am writing tests for my graphene app. I need to test whether certain queries produce errors. When `client.execute(...)`is run, this logs an annoying `graphql.error.located_error.GraphQLLocatedError`. I cannot even use `pytest.raises` or `self.assertRaises` in unittest because it only logs without actually raising an error. It even logs the entire traceback which is even more annoying.

**Describe the solution you'd like**
It'd be much better if we had a solution to have a loglevel flag in `client.execute(...)` or some other way to disable logging of those specific errors.

**Describe alternatives you've considered**
I have considered disabling all error logs from the test runner (with `logging.disable(logging.ERROR)`). I am going with this for now but I don't want to miss out on other important logs which may help in surfacing faulty tests.

**Additional context**
Add any other context or screenshots about the feature request here.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Start at the client.execute(...) entry point and trace how GraphQLLocatedError instances are logged during query execution. Check the existing pytest and unittest behavior described in the issue, then make the logging controllable without suppressing unrelated test-runner logs; done means callers can curb these specific errors while still receiving other important logs.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
api, testing
Tipo de issue
Nueva funcionalidad
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.