PyO3 error
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Necesita aclaración
- Estado de actividad
- Estancado
- Stack tecnológico
- python
- Área
- testing-qa
Línea de trabajo
Reproduce the failure with test_one.py, folder/init.py, folder/some_module.py, and the stated pytest command and package versions. Start by investigating how the --cov=folder.some_module entry point affects imports, then compare runs with and without --cov and with the listed dependency versions. Done means the cause is established and the reproducer no longer fails or the limitation is documented.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Hello,
I am currently debugging weird issue that happens to us only when using --cov arguments to pytest and only during running tests (not in production with the same code).
Reproducer
I was able to narrow it down for this little setup:
create this structure:
.
├── folder
│ ├── __init__.py
│ └── some_module.py
└── test_one.py
Now, some_module.py is empty.
folder/__init__.py has this content:
`from cryptography.hazmat.primitives import hashes`
test_one.py has this content:
`from cryptography.hazmat.primitives import hashes`
When you run this command (note that in my case the whole directory structure is in /home/vagrant/neto directory):
`PYTHONPATH=$PYTHONPATH:/home/vagrant/neto pytest /home/vagrant/neto/test_one.py --cov=folder.some_module`
you get
ImportError while importing test module '/home/vagrant/neto/test_one.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../.pyenv/versions/3.8.18/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
test_one.py:2: in <module>
from cryptography.hazmat.primitives import hashes
../venv/pack/lib/python3.8/site-packages/cryptography/hazmat/primitives/hashes.py:10: in <module>
from cryptography.hazmat.bindings._rust import openssl as rust_openssl
E ImportError: PyO3 modules may only be initialized once per interpreter process
explanation
Reasons why I think (though not sure) the problem is in python-cov:
- you can switch
from cryptography.hazmat.primitives import hashesforimport jsonschemaand you get the into the same error. - we dont get any errors in production with the other imported packages.
- you remove the --cov attribute and it runs without errors.
- that importError sounds like that it might be caused by the way --cov path is handled internally?
versions
- python 3.8.18
- pytest 7.4.2
- pytest-cov 4.1.0
- jsonschema 4.19.1, problem doesnt appear when downgrading to 4.17.3
- cryptography 41.0.4, problem doesnt appear when downgrading to 40.0.2
- Lenguaje dominante
- Python
- Estrellas
- 2.1k
- Forks
- 256
- Merge medio
- 6 d 10 min
- PR fusionados (30 d)
- 2
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
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.
Más de pytest-dev/pytest-cov
-
Celery tests require package; test blows up if Celery not installed instead of skipping the tests gracefullyPosiblemente ocupada @dchaudhari7177 la tomó hace 104 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
pytest-dev/pytest-cov#750 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
pytest-dev/pytest-cov#617 · 1 comentario ·
-
Only set dynamic context on coveragepy cores supporting it, perhaps?Posiblemente ocupada @terminalchai la tomó hace 19 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
pytest-dev/pytest-cov#755 · 3 comentarios ·
-
INTERNALERROR when generating html report using pytest-cov 7.1.0 with jinjaPosiblemente ocupada @daleselaji-dev la tomó hace 90 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 58/100
pytest-dev/pytest-cov#748 ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 28/100
pytest-dev/pytest-cov#747 · 1 reacción ·
Todos los issues de pytest-dev/pytest-cov
Issues similares
-
ChatBedrockConverse changes the keys of JSON tool results to camelCase (`order_id` becomes `orderId`)Posiblemente ocupada @geyazheng la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
langchain-ai/langchain-aws#1469 ·
Los mantenedores suelen responder en 1 día
-
GCToggler leaves collection enabled if the body re-enables itPosiblemente ocupada @Gambit-Checkmate la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 7 días
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
EESSI/docs#949 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
doronz88/pymobiledevice3#2176 ·
Los mantenedores suelen responder en 1 día
-
b4b usability
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día