panoptes-python-client icon indicating copy to clipboard operation
panoptes-python-client copied to clipboard

Project tests report unclosed socket warnings

Open camallen opened this issue 4 years ago • 1 comments

Tests are showing warnings about unclosed sockets (python 3.9).

It appears we we aren't tearing down the request session socket correctly https://stackoverflow.com/questions/48160728/resourcewarning-unclosed-socket-in-python-3-unit-test but I don't see these warnings when using the code (perhaps due to logging contexts?)

From https://github.com/zooniverse/panoptes-python-client/runs/4251790766?check_suite_focus=true

./home/runner/work/panoptes-python-client/panoptes-python-client/panoptes_client/panoptes.py:622: ResourceWarning: unclosed <ssl.SSLSocket fd=3, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('10.1.1.45', 39214), raddr=('13.107.213.41', 443)>
  return Panoptes.client().get(
ResourceWarning: Enable tracemalloc to get the object allocation traceback

These break the panoptes-cli tests

camallen avatar Nov 18 '21 14:11 camallen

related https://github.com/psf/requests/issues/1882 and https://github.com/psf/requests/issues/3912

camallen avatar Nov 18 '21 14:11 camallen