Hi there, I'm using python:3.8 image and trying to run unit test with pytest.
When time.sleep() method is called in order to retry http connection, the step abruptly stops without any error and log.
How can I debug or resolve this? Thanks
Pytest command
pipenv run pytest --capture=tee-sys
Code:
try:
with socket.create_connection((host, port), timeout=timeout):
logger.info(f"port={port} is ready")
break
except OSError as ex:
try:
logger.info("Performing an action which may throw an exception.")
logger.info(time.asctime())
time.sleep(3)
except:
logger.info("Everything looks great!")
finally:
logger.info(
"Finally is called directly after executing the try statement whether an exception is thrown or not.")
Output on the pipeline console:
Hey @Hiro Nakamata , welcome to the Atlassian community.
Can you make pytest to be more verbose with the output and to do all logging on standard output and error? This should normally reveal more.
In general it means that an error occurred.
You can debug your pipeline locally, please see: Debug pipelines locally with Docker and the other documents in that section.
Running the pipeline locally is great for debugging, some tooling like bbrun or pipelines exist.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would run this locally inside a container and then see if it is reproducible.
And if I may ask, why may
time.sleep(3)
throw an exception?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.