From 9513947bf0735df2938131c47d71d213d74350ad Mon Sep 17 00:00:00 2001 From: rbovill Date: Thu, 26 Oct 2023 15:40:04 -0700 Subject: [PATCH] Mocking the command-line argument. --- tests/test_obssys_state_transitions.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/test_obssys_state_transitions.py b/tests/test_obssys_state_transitions.py index 4264c17b..970c217b 100644 --- a/tests/test_obssys_state_transitions.py +++ b/tests/test_obssys_state_transitions.py @@ -21,6 +21,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import sys import unittest import yaml @@ -52,8 +53,12 @@ async def test_obssys_standby_disabled(self) -> None: module. """ + # Mock the command-line arguments that the obssys_standby_disabled.py + # script expects. + test_env = "tts" + sys.argv[1:] = [test_env] # Instantiate the ObsSysStandbyDisabled integration tests. - script_class = ObsSysStandbyDisabled(test_env="tts") + script_class = ObsSysStandbyDisabled(test_env=test_env) # Get number of scripts and the configuration. num_scripts = len(script_class.scripts) script_config = yaml.safe_load(script_class.configs[0]) @@ -73,8 +78,12 @@ async def test_obssys_disabled_enabled(self) -> None: module. """ + # Mock the command-line arguments that the obssys_disabled_enabled.py + # script expects. + test_env = "bts" + sys.argv[1:] = [test_env] # Instantiate the ObsSysDisabledEnabled integration tests. - script_class = ObsSysDisabledEnabled(test_env="bts") + script_class = ObsSysDisabledEnabled(test_env=test_env) # Get number of scripts and the configuration. num_scripts = len(script_class.scripts) script_config = yaml.safe_load(script_class.configs[0])