fix: change _client reference to _conn (#3188)

This code previously referenced `self._client`, which does not exist.
This change makes it correctly call `self._conn.close()`
This commit is contained in:
Dan Tasse
2026-03-31 16:29:17 -04:00
committed by GitHub
parent 7b1c063848
commit 97754f5123
2 changed files with 13 additions and 1 deletions

View File

@@ -568,4 +568,4 @@ class RemoteDBConnection(DBConnection):
async def close(self):
"""Close the connection to the database."""
self._client.close()
self._conn.close()

View File

@@ -1201,6 +1201,18 @@ async def test_header_provider_overrides_static_headers():
await db.table_names()
def test_close():
"""Test that close() works without AttributeError."""
import asyncio
def handler(req):
req.send_response(200)
req.end_headers()
with mock_lancedb_connection(handler) as db:
asyncio.run(db.close())
@pytest.mark.parametrize("exception", [KeyboardInterrupt, SystemExit, GeneratorExit])
def test_background_loop_cancellation(exception):
"""Test that BackgroundEventLoop.run() cancels the future on interrupt."""