Skip to content

armgit / txtai

Public Imported from GitHub
0

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

Skip word vector embeddings test on macOS

davidmezzetti3ac6a5b332f3
diff --git a/test/python/testembeddings.py b/test/python/testembeddings.py
index 9e455c34..0923bc4d 100644
--- a/test/python/testembeddings.py
+++ b/test/python/testembeddings.py
@@ -5,11 +5,10 @@ Embeddings module tests
import contextlib
import io
import os
+import platform
import tempfile
import unittest
-from unittest.mock import patch
-
import numpy as np
from txtai.embeddings import Embeddings
@@ -157,15 +156,12 @@ class TestEmbeddings(unittest.TestCase):
self.assertEqual(uid, 0)
- @patch("os.cpu_count")
- def testWords(self, cpucount):
+ @unittest.skipIf(platform.system() == "Darwin", "Word vector embeddings tests skipped on macOS")
+ def testWords(self):
"""
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)
diff --git a/test/python/testvectors/testwordvectors.py b/test/python/testvectors/testwordvectors.py
index 9c072dbc..cc4d7747 100644
--- a/test/python/testvectors/testwordvectors.py
+++ b/test/python/testvectors/testwordvectors.py
@@ -3,11 +3,10 @@ Vectors module tests
"""
import os
+import platform
import tempfile
import unittest
-from unittest.mock import patch
-
from txtai.vectors import WordVectors, VectorsFactory
@@ -47,15 +46,12 @@ class TestWordVectors(unittest.TestCase):
self.assertTrue(model.initialized)
- @patch("os.cpu_count")
- def testIndex(self, cpucount):
+ @unittest.skipIf(platform.system() == "Darwin", "Word vector embeddings tests skipped on macOS")
+ def testIndex(self):
"""
- Test word vector indexing
+ Test word vectors indexing
"""
- # Mock CPU count
- cpucount.return_value = 2
-
# Generate data
documents = [(x, "This is a test", None) for x in range(1000)]