💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows
Python agentsaiai-agentsembeddingsinformation-retrievallanguage-modellarge-language-modelsllmnlppythonragretrieval-augmented-generationsearchsearch-enginesemantic-searchsentence-embeddingstransformerstxtaivector-databasevector-search
Add test for API __del__ method
davidmezzetti07c2495952ec
diff --git a/src/python/txtai/api/base.py b/src/python/txtai/api/base.pyindex 92ca8082..41f6b9e6 100644--- a/src/python/txtai/api/base.py+++ b/src/python/txtai/api/base.py@@ -90,6 +90,7 @@ class API:if self.pool:self.pool.close()+ self.pool = Nonedef pipes(self):"""diff --git a/test/python/testapi/testworkflow.py b/test/python/testapi/testworkflow.pyindex ae9104c1..b36b9800 100644--- a/test/python/testapi/testworkflow.py+++ b/test/python/testapi/testworkflow.py@@ -8,12 +8,13 @@ import tempfileimport unittestfrom http.server import HTTPServer, BaseHTTPRequestHandler+from multiprocessing.pool import ThreadPoolfrom threading import Threadfrom unittest.mock import patchfrom fastapi.testclient import TestClient-from txtai.api import app, start+from txtai.api import app, start, API# Configuration for workflowsWORKFLOWS = """@@ -175,6 +176,17 @@ class TestWorkflow(unittest.TestCase):cls.httpd.shutdown()+ def testAPICleanup(self):+ """+ Test API threadpool closed when __del__ called.+ """++ api = API({})+ api.pool = ThreadPool()+ api.__del__()++ self.assertIsNone(api.pool)+def testServiceGet(self):"""Test workflow with ServiceTask GET via API