SNOW-1017125: running pytest.main() programmatically hangs starting with snowflake-connector-python v3.4.1
Python version
3.10.5
Operating system and processor architecture
ubuntu 22.04
Installed packages
Package Version
-------------------------- -----------
APScheduler 3.9.1
asn1crypto 1.5.1
attrs 21.4.0
boto3 1.24.10
botocore 1.27.10
certifi 2022.6.15
cffi 1.15.0
charset-normalizer 2.0.12
colorlog 6.6.0
coverage 7.1.0
cryptography 36.0.2
gevent 21.12.0
greenlet 1.1.2
humanize 4.1.0
idna 3.3
influxdb 5.3.1
iniconfig 1.1.1
Jinja2 3.1.2
jmespath 1.0.0
MarkupSafe 2.1.1
mockito 1.4.0
msgpack 1.0.4
nest-asyncio 1.5.5
oscrypto 1.3.0
packaging 21.3
pip 20.2.2
pluggy 1.0.0
psycopg2-binary 2.9.3
py 1.11.0
pycparser 2.21
pycryptodomex 3.14.1
PyJWT 2.4.0
PyMySQL 1.0.2
pyOpenSSL 22.0.0
pyparsing 3.0.9
pytest 7.1.2
pytest-cov 4.0.0
python-dateutil 2.8.2
python-json-logger 2.0.2
pytz 2022.1
pytz-deprecation-shim 0.1.0.post0
requests 2.28.0
s3transfer 0.6.0
setuptools 49.6.0
six 1.16.0
snowflake-connector-python 3.4.1
snowflake-sqlalchemy 1.3.4
SQLAlchemy 1.4.37
tomli 2.0.1
toposort 1.9
tzdata 2022.1
tzlocal 4.2
ujson 5.3.0
urllib3 1.26.9
zope.event 4.5.0
zope.interface 5.4.0
What did you do?
sys.exit(
pytest.main(
[
"-ra",
"--import-mode=append",
]
+ <some test using snowflake connector>
)
)
What did you expect to see?
expected pytest.main() to complete
Can you set logging to DEBUG and collect the logs?
import logging
import os
for logger_name in ('snowflake.connector',):
logger = logging.getLogger(logger_name)
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
ch.setFormatter(logging.Formatter('%(asctime)s - %(threadName)s %(filename)s:%(lineno)d - %(funcName)s() - %(levelname)s - %(message)s'))
logger.addHandler(ch)
What's your auth method to snowflake? Is it possible that hanging is caused by asking for auth? Or could you provide more details about your test?
What's your auth method to snowflake? Is it possible that hanging is caused by asking for auth? Or could you provide more details about your test?
authorization method is aws assumed-role I forgot to mention that this actually works as expected with pytest console_script, meaning the CLI script. but it hangs when running programmatically through pytest.main(). Sounds like its not cleaning up resources after its done.
works on v3.4.0 hangs on v3.4.1
is it possible to share your script with us or any workload would hang in this case?
closing this issue for now as there been no response for a long time now, but if you still see this issue please let us know and we can work on it once the reproduction is made available