
* Add references to Cores in Cache, ctx holds caches, caches hold cores, everything gets cleaned up nicely * GC in Python seems to be a bit lazy, if we want to run CI on low-memory machines we need to make sure it does run in between tests 'cause we don't want no huge Volumes hanging around for long Signed-off-by: Jan Musial <jan.musial@intel.com>
40 lines
933 B
Python
40 lines
933 B
Python
#
|
|
# Copyright(c) 2019 Intel Corporation
|
|
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
|
#
|
|
|
|
import os
|
|
import sys
|
|
import pytest
|
|
import gc
|
|
|
|
sys.path.append(os.path.join(os.path.dirname(__file__), os.path.pardir))
|
|
from pyocf.types.logger import LogLevel, DefaultLogger, BufferLogger
|
|
from pyocf.types.volume import Volume, ErrorDevice
|
|
from pyocf.types.ctx import get_default_ctx
|
|
|
|
|
|
def pytest_configure(config):
|
|
sys.path.append(os.path.join(os.path.dirname(__file__), os.path.pardir))
|
|
|
|
|
|
@pytest.fixture()
|
|
def pyocf_ctx():
|
|
c = get_default_ctx(DefaultLogger(LogLevel.WARN))
|
|
c.register_volume_type(Volume)
|
|
c.register_volume_type(ErrorDevice)
|
|
yield c
|
|
c.exit()
|
|
gc.collect()
|
|
|
|
|
|
@pytest.fixture()
|
|
def pyocf_ctx_log_buffer():
|
|
logger = BufferLogger(LogLevel.DEBUG)
|
|
c = get_default_ctx(logger)
|
|
c.register_volume_type(Volume)
|
|
c.register_volume_type(ErrorDevice)
|
|
yield logger
|
|
c.exit()
|
|
gc.collect()
|