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

davidmezzettid646ca70c869
diff --git a/test/python/testpipeline/testtranslation.py b/test/python/testpipeline/testtranslation.py
index d76857e2..f301e8e7 100644
--- a/test/python/testpipeline/testtranslation.py
+++ b/test/python/testpipeline/testtranslation.py
@@ -3,7 +3,6 @@ Translation module tests
"""
import os
-import platform
import unittest
from txtai.pipeline import Translation
@@ -27,7 +26,7 @@ class TestTranslation(unittest.TestCase):
# Validate translation text
self.assertIsNotNone(translation)
- @unittest.skipIf(os.name == "nt" or platform.system() == "Darwin", "M2M100 skipped on Windows and macOS")
+ @unittest.skipIf(os.name == "nt", "M2M100 skipped on Windows")
def testM2M100Translation(self):
"""
Tests a translation using M2M100 models
diff --git a/test/python/testvectors/testwordvectors.py b/test/python/testvectors/testwordvectors.py
index 269c4ad7..35a48959 100644
--- a/test/python/testvectors/testwordvectors.py
+++ b/test/python/testvectors/testwordvectors.py
@@ -6,6 +6,8 @@ import os
import tempfile
import unittest
+from unittest.mock import patch
+
from txtai.vectors import WordVectors, VectorsFactory
@@ -45,11 +47,15 @@ class TestWordVectors(unittest.TestCase):
self.assertTrue(model.initialized)
- def testIndex(self):
+ @patch(os.cpu_count)
+ def testIndex(self, cpucount):
"""
Test word vector indexing
"""
+ # Mock CPU count
+ cpucount.return_value = 2
+
# Generate data
documents = [(x, "This is a test", None) for x in range(1000)]