Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable data cache in unit tests #4174

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading