Skip to content

Commit

Permalink
Disable data cache in unit tests (#4174)
Browse files Browse the repository at this point in the history
  • Loading branch information
sovrasov authored Jan 9, 2025
1 parent 4d3df8c commit c3f5e02
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/otx/core/data/mem_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def check_system_memory(cls, mem_size: int, available_cpu_mem: int) -> bool:
"""Check there is enough system memory to maintain memory caching pool.
Parameters:
mem_size: Requested memory size (bytes) for the memory cahcing pool
mem_size: Requested memory size (bytes) for the memory caching pool
available_cpu_mem: Memory capacity (bytes) of this system
Returns:
Return true if there is enough system memory. Otherwise, return false.
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def pytest_addoption(parser: pytest.Parser):
action="store",
default="all",
choices=("speed", "balance", "accuracy", "default", "other", "all"),
help="Choose speed|balcence|accuracy|default|other|all. Defaults to all.",
help="Choose speed|balance|accuracy|default|other|all. Defaults to all.",
)
parser.addoption(
"--data-group",
Expand Down
17 changes: 17 additions & 0 deletions tests/unit/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (C) 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
from __future__ import annotations

import pytest
from otx.core.data.mem_cache import MemCacheHandlerSingleton


@pytest.fixture(autouse=True)
def fxt_disable_mem_cache():
"""Disable mem cache to reduce memory usage."""

original_mem_limit = MemCacheHandlerSingleton.CPU_MEM_LIMITS_GIB
MemCacheHandlerSingleton.CPU_MEM_LIMITS_GIB = 99999999
yield
MemCacheHandlerSingleton.CPU_MEM_LIMITS_GIB = original_mem_limit

0 comments on commit c3f5e02

Please sign in to comment.