import os
from contextlib import suppress
from mdclogpy import Logger
-from ricxappframe.xapp_frame import RMRXapp, CONFIG_FILE_ENV
+
+from ricxappframe.util.constants import Constants
+from ricxappframe.xapp_frame import RMRXapp
mdc_logger = Logger(name=__name__)
rmr_xapp_config = None
def test_config_no_env(monkeypatch):
init_config_file()
- monkeypatch.delenv(CONFIG_FILE_ENV, raising=False)
+ monkeypatch.delenv(Constants.CONFIG_FILE_ENV, raising=False)
def default_rmr_handler(self, summary, sbuf):
pass
time.sleep(3)
assert not config_event_seen
rmr_xapp_noconfig.stop()
+ rmr_xapp_noconfig = None
def test_default_config_handler(monkeypatch):
"""Just for coverage"""
init_config_file()
- monkeypatch.setenv(CONFIG_FILE_ENV, config_file_path)
+ monkeypatch.setenv(Constants.CONFIG_FILE_ENV, config_file_path)
def default_rmr_handler(self, summary, sbuf):
pass
# give the work loop a chance to timeout on RMR and process the config event
time.sleep(3)
rmr_xapp_defconfig.stop()
+ rmr_xapp_defconfig = None
def test_custom_config_handler(monkeypatch):
# point watcher at the file
init_config_file()
- monkeypatch.setenv(CONFIG_FILE_ENV, config_file_path)
+ monkeypatch.setenv(Constants.CONFIG_FILE_ENV, config_file_path)
def default_handler(self, summary, sbuf):
pass
time.sleep(3)
assert change_config_event
rmr_xapp_config.stop()
+ rmr_xapp_config = None
def teardown_module():
"""
os.remove(config_file_path)
with suppress(Exception):
- rmr_xapp_config.stop()
- with suppress(Exception):
- rmr_xapp_defconfig.stop()
- with suppress(Exception):
- rmr_xapp_noconfig.stop()
+ if rmr_xapp_config:
+ rmr_xapp_config.stop()
+ if rmr_xapp_defconfig:
+ rmr_xapp_defconfig.stop()
+ if rmr_xapp_noconfig:
+ rmr_xapp_noconfig.stop()