When running Unittest on the following minimal example of code, I get a Warning that not all resources are closed.
import unittest
import os
from influxdb_client import InfluxDBClient
import tracemalloc
tracemalloc.start()
class InfluxTest(unittest.TestCase):
def setUp(self) -> None:
self.client = InfluxDBClient(url=os.environ.get("INFLUX_URL"),
token=os.environ.get("INFLUX_TOKEN"))
self.bucket_api = self.client.buckets_api()
def tearDown(self) -> None:
self.client.__del__()
del self.bucket_api
def test_connection(self):
self.bucket_api.find_buckets().to_dict()
When I use other APIs like the query_api, I don't get that warning. Does it have something to do with the bucket API not having a __del__() method?
This is the warning I get (I replaced my ip with xxxx):
ResourceWarning: unclosed <socket.socket fd=5, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('x.x.x.x', 50040), raddr=('x.x.x.x', 9999)>
del self.bucket_api
Object allocated at (most recent call last):
File "/Users/myuser/opt/anaconda3/envs/myenv/lib/python3.7/site-packages/urllib3/util/connection.py", lineno 65
sock = socket.socket(af, socktype, proto)`
When running Unittest on the following minimal example of code, I get a Warning that not all resources are closed.
When I use other APIs like the query_api, I don't get that warning. Does it have something to do with the bucket API not having a
__del__()method?This is the warning I get (I replaced my ip with xxxx):