From 0f6f62e3bc69e43a4e2fa746e8769a5d975cca22 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 8 Sep 2023 13:20:35 +0200 Subject: [PATCH] globals are bad --- tests/test_global_manager.py | 37 --------------------------------- tmtccmd/core/globals_manager.py | 5 +++++ 2 files changed, 5 insertions(+), 37 deletions(-) delete mode 100644 tests/test_global_manager.py diff --git a/tests/test_global_manager.py b/tests/test_global_manager.py deleted file mode 100644 index 721d8c46..00000000 --- a/tests/test_global_manager.py +++ /dev/null @@ -1,37 +0,0 @@ -from unittest import TestCase -from tmtccmd.config.globals import ( - update_global, - get_global, - set_json_cfg_path, - get_json_cfg_path, - set_glob_com_if_dict, - get_glob_com_if_dict, - set_default_globals_pre_args_parsing, -) -from tmtccmd.core.globals_manager import ( - lock_global_pool, - unlock_global_pool, - set_lock_timeout, -) - - -class TestGlobalManager(TestCase): - def test_global_module(self): - update_global(global_param_id=30, parameter="hello") - self.assertTrue(get_global(global_param_id=30) == "hello") - - current_path = get_json_cfg_path() - set_json_cfg_path(".") - self.assertTrue(get_json_cfg_path() == ".") - set_json_cfg_path(current_path) - - custom_com_if_dict = {"test": ("Test Interface", "")} - set_glob_com_if_dict(custom_com_if_dict=custom_com_if_dict) - com_if_dict = get_glob_com_if_dict() - self.assertTrue(com_if_dict["test"][0] == "Test Interface") - - set_default_globals_pre_args_parsing(apid=0x02) - - lock_global_pool() - unlock_global_pool() - set_lock_timeout(0.5) diff --git a/tmtccmd/core/globals_manager.py b/tmtccmd/core/globals_manager.py index 8d3a0cbb..87433288 100644 --- a/tmtccmd/core/globals_manager.py +++ b/tmtccmd/core/globals_manager.py @@ -1,5 +1,10 @@ from threading import Lock from typing import Optional +import warnings + +warnings.warn( + "the globals_manager module is deprecated", DeprecationWarning, stacklevel=2 +) __GLOBALS_DICT = dict() __LOCK_TIMEOUT = 50