Skip to content

Commit c3f5e02

Browse files
authored
Disable data cache in unit tests (#4174)
1 parent 4d3df8c commit c3f5e02

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

src/otx/core/data/mem_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ def check_system_memory(cls, mem_size: int, available_cpu_mem: int) -> bool:
323323
"""Check there is enough system memory to maintain memory caching pool.
324324
325325
Parameters:
326-
mem_size: Requested memory size (bytes) for the memory cahcing pool
326+
mem_size: Requested memory size (bytes) for the memory caching pool
327327
available_cpu_mem: Memory capacity (bytes) of this system
328328
Returns:
329329
Return true if there is enough system memory. Otherwise, return false.

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def pytest_addoption(parser: pytest.Parser):
4242
action="store",
4343
default="all",
4444
choices=("speed", "balance", "accuracy", "default", "other", "all"),
45-
help="Choose speed|balcence|accuracy|default|other|all. Defaults to all.",
45+
help="Choose speed|balance|accuracy|default|other|all. Defaults to all.",
4646
)
4747
parser.addoption(
4848
"--data-group",

tests/unit/conftest.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright (C) 2025 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
from __future__ import annotations
5+
6+
import pytest
7+
from otx.core.data.mem_cache import MemCacheHandlerSingleton
8+
9+
10+
@pytest.fixture(autouse=True)
11+
def fxt_disable_mem_cache():
12+
"""Disable mem cache to reduce memory usage."""
13+
14+
original_mem_limit = MemCacheHandlerSingleton.CPU_MEM_LIMITS_GIB
15+
MemCacheHandlerSingleton.CPU_MEM_LIMITS_GIB = 99999999
16+
yield
17+
MemCacheHandlerSingleton.CPU_MEM_LIMITS_GIB = original_mem_limit

0 commit comments

Comments
 (0)