MagicStack / MagicStack/asyncpg
TempCluster() and pytest
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 8.1k
- Forks
- 468
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
- asyncpg version: 0.23.0
- PostgreSQL version: N/A
- Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
the issue with a local PostgreSQL install?: N/A - Python version: 3.8.9 (but N/A)
- Platform: N/A
- Do you use pgbouncer?: N/A
- Did you install asyncpg with pip?: yes
- If you built asyncpg locally, which version of Cython did you use?:
- Can the issue be reproduced under both asyncio and
uvloop?:
This is issue which happens when using TempCluster() for testing as mentioned in https://github.com/MagicStack/asyncpg/issues/589.
Basically invoking cluster.start() causes an error when trying to use in environment that sets up own event loop (like pytest). Because .start() calls self._test_connection(timeout=wait) which creates and uses own event loop (https://github.com/MagicStack/asyncpg/blob/d08a9b8b9c2c68d469aeb9c4112d83c56c24f11c/asyncpg/cluster.py#L467).
This can be worked around by using nest_asyncio package, but it would be great if we could pass the event loop to the start() method so no hacking around that would be needed.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
El fallo informado se encuentra en asyncpg/cluster.py, alrededor de TempCluster.start() y su llamada a _test_connection(timeout=wait). Reproduce la ruta de inicio con pytest u otro entorno que tenga su propio bucle de eventos y, a continuación, determina cómo debería propagarse por esa ruta el argumento de bucle solicitado. Se considera completado cuando cluster.start() puede usar el bucle de eventos del llamador sin requerir nest_asyncio y existe cobertura para el escenario informado.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- postgresql, python
- Área
- databases, testing
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100