From bcc2ef6a7f96b420e7b95733c40477c5e2759f1a Mon Sep 17 00:00:00 2001 From: yusyus Date: Sun, 8 Feb 2026 14:49:45 +0300 Subject: [PATCH] test: Skip tests requiring optional dependencies - Skip test_benchmark.py if psutil not installed - Skip test_embedding.py if numpy not installed - Skip test_embedding_pipeline.py if numpy not installed - Uses pytest.importorskip() for clean dependency handling - Fixes CI test collection errors for optional features --- tests/test_benchmark.py | 3 +++ tests/test_embedding.py | 3 +++ tests/test_embedding_pipeline.py | 3 +++ 3 files changed, 9 insertions(+) diff --git a/tests/test_benchmark.py b/tests/test_benchmark.py index 9163584..20ce600 100644 --- a/tests/test_benchmark.py +++ b/tests/test_benchmark.py @@ -2,10 +2,13 @@ Tests for benchmarking suite. """ +import pytest import time import json from datetime import datetime +# Skip all tests if psutil is not installed +pytest.importorskip("psutil") from skill_seekers.benchmark import ( Benchmark, diff --git a/tests/test_embedding.py b/tests/test_embedding.py index 703734a..f7b2587 100644 --- a/tests/test_embedding.py +++ b/tests/test_embedding.py @@ -7,6 +7,9 @@ import tempfile from pathlib import Path from unittest.mock import patch +# Skip all tests if numpy is not installed +pytest.importorskip("numpy") + from skill_seekers.embedding.models import ( EmbeddingRequest, BatchEmbeddingRequest, diff --git a/tests/test_embedding_pipeline.py b/tests/test_embedding_pipeline.py index 48a34fb..2044801 100644 --- a/tests/test_embedding_pipeline.py +++ b/tests/test_embedding_pipeline.py @@ -15,6 +15,9 @@ from pathlib import Path import sys import tempfile +# Skip all tests if numpy is not installed +pytest.importorskip("numpy") + # Add src to path sys.path.insert(0, str(Path(__file__).parent.parent / "src"))