Skip to content

armgit / txtai

Public Imported from GitHub
0

💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows

Reduce number of vector process indexers for unit test

davidmezzetti9461d2813a74
diff --git a/test/python/testembeddings.py b/test/python/testembeddings.py
index be047ee1..9e455c34 100644
--- a/test/python/testembeddings.py
+++ b/test/python/testembeddings.py
@@ -8,6 +8,8 @@ import os
import tempfile
import unittest
+from unittest.mock import patch
+
import numpy as np
from txtai.embeddings import Embeddings
@@ -155,11 +157,15 @@ class TestEmbeddings(unittest.TestCase):
self.assertEqual(uid, 0)
- def testWords(self):
+ @patch("os.cpu_count")
+ def testWords(self, cpucount):
"""
Test embeddings backed by word vectors
"""
+ # Mock CPU count
+ cpucount.return_value = 2
+
# Initialize model path
path = os.path.join(tempfile.gettempdir(), "model")
os.makedirs(path, exist_ok=True)