-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
50 lines (40 loc) · 1.64 KB
/
conftest.py
File metadata and controls
50 lines (40 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
Global pytest configuration for chunking strategy tests.
This file optimizes test performance by configuring default settings
to avoid hardware detection overhead during testing.
"""
import pytest
import os
# Set environment variables to optimize for testing
@pytest.fixture(scope="session", autouse=True)
def configure_test_environment():
"""Configure optimal settings for test performance."""
# Disable hardware optimization by default in tests (can be overridden)
if "CHUNKING_ENABLE_HARDWARE_OPT" not in os.environ:
os.environ["CHUNKING_ENABLE_HARDWARE_OPT"] = "False"
# Disable GPU detection overhead in tests
if "CHUNKING_FORCE_CPU" not in os.environ:
os.environ["CHUNKING_FORCE_CPU"] = "True"
# Use conservative parallelization settings
if "CHUNKING_DEFAULT_WORKERS" not in os.environ:
os.environ["CHUNKING_DEFAULT_WORKERS"] = "2"
yield
# Cleanup after tests
for key in ["CHUNKING_ENABLE_HARDWARE_OPT", "CHUNKING_FORCE_CPU", "CHUNKING_DEFAULT_WORKERS"]:
os.environ.pop(key, None)
@pytest.fixture
def fast_orchestrator():
"""Create an orchestrator optimized for fast testing."""
from chunking_strategy.orchestrator import ChunkerOrchestrator
return ChunkerOrchestrator(
enable_hardware_optimization=False,
enable_smart_parallelization=True
)
@pytest.fixture
def hw_orchestrator():
"""Create an orchestrator with hardware optimization for performance tests."""
from chunking_strategy.orchestrator import ChunkerOrchestrator
return ChunkerOrchestrator(
enable_hardware_optimization=True,
enable_smart_parallelization=True
)