Files
cmbuyer/client/tests/test_app.py
T

25 lines
880 B
Python

"""验证桌面入口的纯参数处理,不启动 PySide6。"""
from __future__ import annotations
import sys
from pathlib import Path
import unittest
from unittest import mock
CLIENT_ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(CLIENT_ROOT / "src"))
from cmbuyer_client.app import select_application_argv
class ApplicationArgumentsTests(unittest.TestCase):
def test_empty_argument_list_is_not_replaced_with_process_arguments(self) -> None:
with mock.patch("cmbuyer_client.app.sys.argv", ["process-name", "--process-option"]):
self.assertEqual([], select_application_argv([]))
def test_none_uses_process_arguments(self) -> None:
with mock.patch("cmbuyer_client.app.sys.argv", ["process-name", "--process-option"]):
self.assertEqual(["process-name", "--process-option"], select_application_argv(None))